x
login about faq Site discussion (meta-askssc)

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 '09 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 voted first

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 '09 at 03:37 AM

TonyJ gravatar image

TonyJ
26

(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 '09 at 03:04 PM

Rajib Bahar gravatar image

Rajib Bahar
238 1 3 6

(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 '09 at 05:12 AM

RickD gravatar image

RickD
1.6k 1 1 4

(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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1834
x340

asked: Oct 13 '09 at 12:23 AM

Seen: 635 times

Last Updated: Oct 13 '09 at 07:42 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.