x

how to create stored procedures?

hi, i am manish kumar

how to create stored procedures in SQL server 2005, and relationship to primary and candidate key.

more ▼

asked Feb 02, 2010 at 02:35 AM in Default

avatar image

Manish Kumar
1 1 1 2

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

To create a stored procedure use the following syntax:

Create Procedure <name> as
<your query here>

..and execute that as a query

An may I suggest that you look it up further in Books Online (The SQL Server help, reacable from inside Management Studio help menu) to get more info about such things as parameters

more ▼

answered Feb 02, 2010 at 04:39 AM

avatar image

Steinar
1.7k 4 6 10

  • for suggestion to refer to BOL.

Feb 02, 2010 at 05:31 AM Fatherjack ♦♦
(comments are locked)
10|1200 characters needed characters left

In SQL 2005,

When you select NEW Stored procedure, it will create a template for you.

It looks like this -

CREATE PROCEDURE dbo.YOUR_STOREDPROCEDURE_NAME

-- Add the parameters for the stored procedure here

AS

BEGIN

    -- YOUR STATEMENT HERE / QUERY 
SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>

END

GO

more ▼

answered Feb 02, 2010 at 06:25 AM

avatar image

Leo
1.6k 55 59 62

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2018
x455

asked: Feb 02, 2010 at 02:35 AM

Seen: 1234 times

Last Updated: Feb 02, 2010 at 06:37 AM

Copyright 2016 Redgate Software. Privacy Policy