Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Thursday, April 19, 2007 7:07 PM
How do i copy Stored Procedures from one SQL Express database to another?
Thursday, April 19, 2007 10:45 PM ✅Answered | 1 vote
One way is, in Object Explorer (You do have SQL Server Management Studio Express, don't you), expand the Database, expand [Programability], expand [Stored Procedures], then right click on the stored procedure you want. One of the choices will be to [Script AS ...], choose [CREATE], then choose [File]. Save the file, copy the file, take to the other server, open it in Object Explorer, and then execute the file.
Friday, April 20, 2007 3:19 PM ✅Answered
Be sure to save the file with an extension of ".sql".
Then, in SSMSE, Click on [File], [Open], [File...] and navigate to and select your file. when it opens, then execute the code.
Friday, April 20, 2007 4:03 PM ✅Answered
Never mind - i figured out how to do that.
Right-click on source database>Tasks>Generate Script>
Select the source table, select Stored Procedures, then check the required stored procedures, finally save it in a single file with a .sql extension.
Open the file, rename the database to target database name, and execute.
Thanks again...
Friday, April 20, 2007 1:46 PM
Thanks so much for your response Arnie. The part I'm confused about is importing it into the target database. I'm not sure how to do it...
I do use SQL Express Management Studio - from your explanation, I know how to export a stored procedure to a file. I'm unsure of how to import this file...
Friday, April 20, 2007 3:38 PM
I'll just have to rename the database in the stored procedure to that of the target database, right? So executing it this way will cause the stored procedure to be copied over? Thanks again...
I have one last question...sorry to bother you...how do i export and import multiple stored procedures? I just noticed that there are over 30 SPs...doing this for each one would be time-consuming!!