Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Where can I find the syntax for SQL Stored Procedures?

2 Answers

Relevance
  • 2 decades ago
    Favorite Answer

    create stored procedure proc_name

    varname1 type1,

    varname2 type2

    as

    --then put proc code here.

  • 2 decades ago

    Here is a sample:

    --USING OUTPUT PARAMETERS

    --pass in customer id

    --out comes total sales

    create proc getsales

    (@customerid varchar(10),

    @total_sales money OUTPUT)

    as

    select @total_sales = sum(unitprice * quantity)

    from [order details] od inner join orders o

    on od.orderid = o.orderid

    where o.customerid = @customerid

    go

    --

    declare @sales money

    exec getsales

    @customerid = 'VINET',

    @total_sales = @sales

    select @sales

    go

    drop proc getsales

    go

Still have questions? Get your answers by asking now.