x

How to do stored procedure?

I need to do stored procedure for my project but I have no idea on starting it. Please help.

Thanks.

more ▼

asked Oct 13, 2009 at 12:23 AM in Default

lala gravatar image

lala
21 2 2 2

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

3 answers: sort oldest

Start by learning some basic SQL. You can do this by reading some basic articles in SQL Server Books On Line or on may web sites (SQLTeam.com, SQLServerCentral, SSWUG.org, etc, etc) then creating simple queries in your database or in one of the sample databases (download from microsoft.com) and looking at the SQL view.

Then to create a stored proc, if your using SQL Server 2005, open the Programmability folder, right-click on Stored Procedures and click New Stored Procedure. It will start by creating a stored proc from a template and you can go from there.

I found that it was best to look at a lot of samples, execute them and make a few changes to them before embarking on creating my own stored procs.

Good luck!
Tony

more ▼

answered Oct 13, 2009 at 03:37 AM

TonyJ gravatar image

TonyJ
26

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

Alternatively, if you want to code a procedure in T-SQL, look up CREATE PROCEDURE in Books Online (SQL's help file).

more ▼

answered Oct 13, 2009 at 05:12 AM

RickD gravatar image

RickD
1.7k 1 1 4

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

I'll point you to Aaron Bertrand's blog entry on best practices on stored procs. I think it'll be a good read for you.

See http://sqlblog.com/blogs/aaron_bertrand/archive/2008/10/30/my-stored-procedure-best-practices-checklist.aspx.

more ▼

answered Oct 13, 2009 at 03:04 PM

Rajib Bahar gravatar image

Rajib Bahar
238 3 4 7

(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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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:

x1945
x408

asked: Oct 13, 2009 at 12:23 AM

Seen: 2746 times

Last Updated: Oct 13, 2009 at 07:42 AM