?
Solved

How to create a stored procedure in sql 2005?

Posted on 2008-10-16
3
Medium Priority
?
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 1200 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 800 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

764 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