Scripting out sqlserver 2005 stored procedures?

  • Hi there! On my local SQL Server 2k8 machine I'm able to use SQL Server Powershell to script out SPs from our SQL2k8 instances...is there a way for me to script out SPs from our SQL Server 2005 boxes?

    Thank you!

  • Yep. Right click the database in SSMS (either 2008 or 2005 SSMS), and select Tasks->Generate Scripts.

    Then follow the wizard to select the stored procs and all of the options.

    Jim

    Jim Murphy
    http://www.sqlwatchmen.com
    @SQLMurph

  • Is there a way to do it through powershell though? The reason i'm asking is that i'd like to have powershell enumerate through a text list of specific SPs we need to script out builds/deployments and hand clicking them one at a time through SSMS might not be the most efficient or accurate way. =)

  • It depends on how you're making the call. If you want to run the PowerShell script directly from the 2005 server, you need to go and get Powershell installed there since it might not be. Then you can call it as if it were command line arguments. But you can just connect to any SQL Server instance directly from Powershell running on a client machine or on a server and the run SQL commands that way assuming you're using SMO.

    "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