Solved

How to create a stored procedure in sql 2005?

Posted on 2008-10-16
3
260 Views
Last Modified: 2010-03-20
Hi, In MS SQL Server Management Studio, I clicked File and New but it only offer to create Query.  
1.  How can I create a stored procedure?  Do I just type Create Procedure in the Query editor?
2.  How do I name the stored proecude?  Internet example of dbo.xxxx.  Do I use my login-name.procedure-name?  Or can I just give it a prcedure name like MyProcedure?

Thank you.
0
Comment
Question by:lapucca
3 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 300 total points
ID: 22735967
create procedure YOURPROCEDURENAME
as

print 'This is your procedure'

-- do stuff here
0
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 200 total points
ID: 22735977
>Do I just type Create Procedure in the Query editor?
yes

or

go to the database, choose the programmability -> stored procedure, and right-click and choose "new" there.
0
 

Author Comment

by:lapucca
ID: 22736111
Yeah, but I can only save it as a query when I click to save it in the query editor though.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question