SillyMS


I need to run a job every night which outputs all the Create Table DDL for all the production tables in a Database. Kind of like EM does. Is there a way to do this with a script It has to pickup new tables as we go . . .

Thanks!




Re: How do I output table DDL text?

K H Tan


Yes. Make use of INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS






Re: How do I output table DDL text?

JHunter

The easiest option would be to use SQL-DMO and the Script method of a Table object.

If you're willing to spend a couple of hundred dollars, I use ApexSQL Doc to script entire databases on a weekly (or adhoc) basis. BI Documentor is also looking really good as an alternative!

Jamie






Re: How do I output table DDL text?

SillyMS

Hi!

I did settle on sql-dmo because I could not wait for a better suggestion. It has to run in a Job/DTS package. Thanks for your comments.

Michael