Capturing the DDL from SQL Server 2000 Tables

Richard Waymire helps a reader retrieve existing DDL information for rows in a new SQL Server 2000 table.

Richard Waymire

October 23, 2001

1 Min Read
ITPro Today logo in a gray background | ITPro Today

I want each row in a new table I'm developing to contain the Data Definition Language (DDL) of one of my existing SQL Server 2000 tables. Which system files do I need to manipulate to capture the DDL? I could use script generation to create this table manually, but I need a more automated process. I prefer to develop the table in T-SQL and not venture into SQL-DMO programming. Can you help?

You can rebuild the DDL without using SQL-DMO scripting by querying SQL Server's information schema views, which include TABLES and COLUMNS views and additional views for constraints and other objects. Note, however, that rebuilding the DDL without using SQL-DMO scripting isn't as easy as it first appears, so you might want to take a quick look at SQL-DMO again. It will make the rebuilding process a lot easier.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like