Create a stored procedure:
Use [ais20140425092531]
Go
/***** Object: storedprocedure [DBO]. [hbsh_ms_billtype_in_ofmine] script Date: 09/01/2014 14:34:24 ******/
Set ansi_nulls on
Go
Set quoted_identifier on
Go
Create procedure [DBO]. [hbsh_ms_billtype_in_ofmine]
-- Add the parameters for the stored procedure here
@ Type varchar (20) -- add query Condition Parameters
As
Begin
-- Set nocount on added to prevent extra result sets from
-- Interfering with select statements.
Set nocount on;
-- Insert statements for procedure here
-- Create a temporary table, store the film, and name of the glue supplier
Create Table # temp (
Id int identity (1, 1 ),
Name varchar (50 ),
FTYPE int
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name,
FTYPE
)
(
Select ts. fname, 200
From t_supplier TS
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name, FTYPE
)
(
Select ts. fname, 200 from ais2014042692652.dbo. t_supplier TS
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name,
FTYPE
)
Values
(
'Hebei smart ',
200
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name,
FTYPE
)
(
Select to1.fname, 201 from t_organization to1
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name,
FTYPE
)
(
Select to1.fname, 201 from ais20140417092652.dbo. t_organization to1
)
Insert into # temp
(
-- Id -- this column value is auto-generated
Name,
FTYPE
)
(
Select HMC. fname, HMC. FTYPE from acctcommerce. DBO. hbsh_ms_customname HMC
)
Select T. Name, T. FTYPE from # temp t where [email protected] group by T. Name, T. FTYPE
End
--- Execute the Add Condition content
Exec [hbsh_ms_billtype_in_ofmine] ''-- directly add the filtering conditions in single quotes.
Use of simple stored procedures