SQL Server 2008 R2 – Copy database schema objects – Generate script for all tables, contraints, functions, stored procedure and triggers

As DBA, Copying database objects like tables, stored procedure, views, triggers either on UAT or DEV. Schema refresh is another example of copying all database objects to another instance. In sql server 2008 and r2, you can use generate script wizard to script out entire database object.

Follow the steps below to script out entire database objects

1. Select the database that you want to script out. Right click on it, select Tasks then Generate Script option.

sql server-generate script wizards

 

2. It will display the introduction of generate script wizards, click on next to proceed.

 

sql server-generate and publish scripts

 

 

3. Here, you can select one option out of two. One is to script entire database and all database objects.

 

script entire database and all database objects

 

 

4. In second option, you can choose database objects that you want to script out. In my case, we are going with default option. click next to proceed.

select the database objects to script.

 

 

5. Now save all scripts either in file or in new query window, we have selected default option.

save script in file and file location

 

 

6. Here, you will see confirmation that all database objects are successfully copied in file.

 

sql server - saving script of database objects

 

 

Bingo click on finish to complete. Now you will see all script are copied in file.

 

 

Leave a Reply

  

  

  


− 3 = 1