Tuesday, March 20, 2012

Script Objects on SQL Server

Hi..

I need a script to export all the objects from my DB, I can't use DTS because this server is on another private LAN , so the only thing that i can do is drop a *.sql file on a common sharing server and my other server will execute it from that location.

What do you recommend? I know i can do it from My Enterprise Manager but i need to run it on a schedule time ....

Anybody has a script for it ? Any clue?

Thanks a lot.
:DIf you don't plan to change your schema, then you can script your DB using EM and save the script as a file.

If changes are anticipated, you can look into using SQL-DMO and write your own script. You can also google "Script database" and am sure you'll find a couple of hits there.|||The schema is changing always ...

It's for the QA guys but they work on a private LAN ... They can't reach our Production LAN..|||Look up this file in your directory structure (scptxfr.exe). My personal edition has it in C:\Program Files\Microsoft SQL Server\MSSQL\Upgrade directory.

Also, check http://database.ittoolbox.com/code/d.asp?d=1691&a=s|||In case you still wonder, this is a sample command line that would generate all objects of PUBS database:

"C:\Program Files\Microsoft SQL Server\MSSQL\Upgrade\scptxfr.exe" /s <SERVER_NAME> /I /d pubs /r /f C:\test.sql

No comments:

Post a Comment