Create a stored procedure: USE [ais20140425092531] GO ****** Object: StoredProcedure [dbo]. [HBSH_MS_BillType_in_ofmine] ScriptDate: 0901201414: 34: 24 ****** SETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGOCREATEPROCEDURE [dbo]. [HBSH_MS_BillType
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
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 t. ftype = @ type 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.