Use of simple stored procedures

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.