tags:

views:

21

answers:

1

Hi .. Is there any way that i can generate the DDL scripts fro all the objects (tables,procdures etc) in SQLquery analyzer at a time? Please help.

A: 

For SQL Server

  • You can use sp_helptext to generate the scripts for stored procedures.
  • You can use this or this to script out tables.

You can create a cursor for the following queries -

SELECT * FROM sys.tables;
SELECT * FROM sys.procedures;

You can then run through the cursor and emit the scripts for the tables and procedures using PRINT statement, and voila, you have to scripts in your message window.

Kirtan