Exporting Stored Procs/Views?

  • **I'm not sure what section to put this in so I'll go ahead and put it into General. Please move if there is a more appropriate place.

    ------------------------------------------------------------

    I'm upgrading a legacy application that was written entirely in Access to SQL Server/ASP.NET. The Access application had hundreds of "Queries" in it, that I have converted into SQL Views and Stored Procedures. I also had numerous other schema changes I made to make the application work correctly. I am at the point where I am planning on how to go live with this application, which will involve taking a fresh version of the Access database, converting it to SQL Server again, and the applying my changes. Is there an easy way to copy the Stored Procs and Views from one database to another database, or am I going to have to write some massive script and cut and paste all the Create Proc and Create View code from my existing database into it to recreate all of these SPs and Views?

  • Right click in EM and you should see a task for generating scripts.  (It might be under all tasks.)

  • Huh, thanks, that's cool. How do I run that script so it updates the database I want? I notice it has:

    N'[dbo].

    Does that just mean use the currently opened DB?

  • N' = Unicode characters (i.e. 'test' is plain ASCII, N'test' is Unicode)

    [dbo]. = the object owner (i.e. [dbo].[myProc] is owned by the dbo alias, [user1].[myProc] is owned {and therefore a different object} by user1)

    The script generated in SQL Enterprise Manager can be executed using Query Analyser.  Connect to the new database, drag & drop the script file or copy/paste the query, verify the connection is still to the intended db and execute...

     

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

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