Microsoft SQL Server Management Studio Question

  • I am new to writing stored procedures and this will be my first stored procedure written with Microsoft SQL Server Management Studio. I am familiar with working with VS 2010 and I have noticed that the IDE is very different. So, let's start with the basics. How do I go about adding a new stored procedure into the group of stores procedures that the project currently has. I already know that name and the T-SQL code I need. I just need to put it.

  • if i understand correctly you need to create a Stored Procedure in your SQL 2005 or later Databases.

    Steps :

    1 . Open SQL Server management Studio

    2. Select you SQL Server Name and login to your instance

    3. You can see left hand side you server name tree will be build and expand the tree you can see the list of databases

    4. Expand your Database Tree you can find folder called Stored Procedure , Right click on Stored procedure and Select NEw Query window. and paste you T-SQL (Create Store procedure Code)

    5. Make sure that you have the error free T-SQL

    6. Press F5 , your command will executed sucessflully and will create a new stored procedure and you can see them in the Stored procedure tree in the Step no 4.

    In case you are looking for this let us know breifly about your query.

  • Xarzu (10/13/2010)


    I am new to writing stored procedures and this will be my first stored procedure written with Microsoft SQL Server Management Studio. I am familiar with working with VS 2010 and I have noticed that the IDE is very different. So, let's start with the basics. How do I go about adding a new stored procedure into the group of stores procedures that the project currently has. I already know that name and the T-SQL code I need. I just need to put it.

    VS2010 contains Object Explorer. If you are using database project then go to schema editor/viewer and drip down to stored procedure folder. Right click -> add new stored procedure -> type stored proc name & add your code.

    Thanks

  • Another way to generate procedures, that many people don't take advantage of, is to use the Templates offered by SSMS. If you click on the View menu and then Template Explorer, or hit Ctl-Alt-T, you'll see a window open with a whole bunch of folders. Scroll down to Store Procedures and open it. You'll see several options for creating procedures, including the "Create Stored Procedure (New Menu)" option, which is what you get when you bring up the context menu by right clicking on the Procedures folder in a database. Opening any of these will show you a template for creating a procedure. Make sure that you're in the correct database before running this code. If you hit Ctl-Shift-M you'll get a window that will allow you to replace the embedded parameters so that you can name your procedure and all the rest. It's also possible to create your own templates, so you can put error handling routines & other internal standards into a template and then use it.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply