Results 1 to 6 of 6

Thread: SQL Server 2008 - Saving Modified Stored Procedure

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    SQL Server 2008 - Saving Modified Stored Procedure

    I have a ton of stored procedures that I developed when we had SQL Server 2000.

    Today, I had to make a change to one of them. We are now running SQL Server 2008 and I'm using Management Studio, not Enterprise Manager.

    In Management Studio, I right clicked on the stored procedure, clicked "Modify", and a whole bunch of changes, but it doesn't want to let me save them back to the stored procedure. It wants to save what I did to a disk file as SQLQuery1.sql

    How do simply resave the stored procedure?

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: SQL Server 2008 - Saving Modified Stored Procedure

    Once the sp is in the query windows (It will have ALTER PROCEDURE at the top). Make the changes in this window. Once all changes made either press Execute button in the tool bar or Press F5 key to do it. This will write the changes back to the DB
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: SQL Server 2008 - Saving Modified Stored Procedure

    Can you create a procedure ? (and then modify it ?)

    For example, can you run this ?
    Code:
    IF OBJECT_ID('dbo.spx_test') IS NOT NULL
    	DROP PROCEDURE dbo.spx_test
    GO
    
    CREATE PROCEDURE dbo.spx_test
    AS
    BEGIN
    	SET NOCOUNT ON;
    	
    	SELECT NEWID() AS New_ID
    END
    GO
    
    ALTER PROCEDURE [dbo].[spx_test]
    AS
    BEGIN
    	SET NOCOUNT ON;
    	
    	SELECT NEWID() AS New_ID
    END
    GO
    
    DROP PROCEDURE dbo.spx_test
    GO
    I'm thinking that you don't have the correct permissions. When you backup (from 2000) and recover (to 2008), you probably lost the "connection" between the users that are on database level and the users that on SQL Server level.

    You probably have to remove the users at the database level, and re-add them.

  4. #4

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: SQL Server 2008 - Saving Modified Stored Procedure

    Quote Originally Posted by GaryMazzone View Post
    Once the sp is in the query windows (It will have ALTER PROCEDURE at the top). Make the changes in this window. Once all changes made either press Execute button in the tool bar or Press F5 key to do it. This will write the changes back to the DB
    My Hero...thanks

  5. #5
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: SQL Server 2008 - Saving Modified Stored Procedure

    LOL, I had no idea that Enterprise Manager in SQL Server 2000 does not change to "alter procedure". Even though I worked with SQL Server 2000 databases before, I always connected to the database through the Management Studio interface from 2005.

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: SQL Server 2008 - Saving Modified Stored Procedure

    as a matter of habbit, I never alter procedure... always drop and create...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Click Here to Expand Forum to Full Width