Results 1 to 7 of 7
  1. #1
    Join Date
    May 2007
    Posts
    18

    Unanswered: 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.

  2. #2
    Join Date
    May 2007
    Posts
    18
    How do I save it? In the Object Explorer, there is already a list of stored procedures and I want my stored procedure in that list.

    You see, I am accessing this stored procedure through a C# WPF user interface

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    There is not such a thing as "SAVE". You have database objects that you CREATE, ALTER and DROP.

    Your stored procedure syntax just needs executing
    Code:
    CREATE PROCEDURE
    MyProc
    AS
    .....
    GO
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    also if you right click on "stored procedures" in object explorer you can select "new stored procedure..." which will give you a script template to follow.

  5. #5
    Join Date
    Sep 2011
    Posts
    71
    Ok ,Also you can use alter instead create if already exist and you want to make update ,But without any thing the sql server engine automatically replace create to alter ,Show example below for details

    ALTER PROCEDURE [dbo].[UpdateQuery]
    (
    @OrgContent ntext,
    @Original_ID smallint,
    @ID smallint
    )
    AS
    SET NOCOUNT OFF;
    UPDATE StaffList
    SET OrgContent = @OrgContent
    WHERE (ID = @Original_ID);

    SELECT ID, URL, OrgContent FROM StaffList WHERE (ID = @ID)

  6. #6
    Join Date
    Sep 2011
    Posts
    31
    In SSMS, Click on File > New > Database Engine Query,
    A dialog box will open, You need to enter server details and login credentials.
    After successfully logging in, You will get a query window.
    Select your database from the drop down below the menu bar.

    Paste your create procedure/alter procedure code in that window (as suggested above)
    Click on Query>Execute or simply press F5.
    Your procedure will be created.

    To verify, Right click your database, click Refresh.
    Expand Programmability > Stored Procedures
    You should see your newly created proc there.

  7. #7
    Join Date
    Sep 2011
    Posts
    75
    Hello,

    Following are the links they will be helpful for creating and modifying the sp

    How to: Create a Stored Procedure (SQL Server Management Studio)

    How to: Modify a Stored Procedure (SQL Server Management Studio)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •