Solved

Microsoft SQL Server Express R2 Create stored procedure with parameters

Posted on 2012-03-25
4
837 Views
Last Modified: 2012-03-26
Hi

I have just downloaded SQL Sever Express 20008 and wanted to build my first stored
procedure with parameters. I take it that I do this in Management Studio. Not sure
where to start or how to do this.

Thanks
0
Comment
Question by:murbro
4 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 167 total points
ID: 37762885
1. Click on New Query.
2. Make sure you are in the right database (change if necessary by using the drop down or USE databasename.
3. Enter your Stored Procedure:
CREATE PROCEDURE dbo.usp_MyProc
    @Param1 integer,
    @Param2 integer
AS 

SET NOCOUNT ON

SELECT  @Param1 Param1,
        @Param2 Param2

Open in new window

0
 
LVL 22

Assisted Solution

by:8080_Diver
8080_Diver earned 167 total points
ID: 37763980
Personally, I think a better approach would be to right click on the Programmability/Stored Procedures and select NEW.  The should bring up a template for the stored procedure.  You can either start working on it immediately or depress <Ctrl><Shift><M> to pop up a dialogue that will let you fill in some information that will jump-start your stored procedure.
0
 
LVL 37

Assisted Solution

by:bbao
bbao earned 166 total points
ID: 37764095
FYI

the essentials for SQL

SQL Server Stored Procedure Basics
http://www.informit.com/articles/article.aspx?p=25288&seqNum=9

the advanced for SQL2K8:

Passing table valued parameters in SQL Server 2008
http://www.techrepublic.com/blog/datacenter/passing-table-valued-parameters-in-sql-server-2008/168
0
 

Author Closing Comment

by:murbro
ID: 37764636
Thanks very much
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 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