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
2009-08-13 09:42:27