Capturing the DDL from SQL Server 2000 Tables

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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.