Extracting Schema

  • Hi,

    How to extract all objects schema(“CREATE” statements) of a database?

    Thanks

  • Depends. Do you want to just do it, or do you want to do it programatically? If you just need a script, right click on the database, select Tasks and Generate Scripts.... That will spit the object scripts out for whatever you want.

    If you want to do it programmatically, you should look at SMO. Personally, I'd use SMO through PowerShell.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks but this is for SQL 7 database objects 🙁

  • One, you're posting in the SQL Server 2005 forum. You might want to take this question to that forum.

    Two, the old SQL Server software had a mechanism for generating scripts as well. I think you could program against it using DMO, but that might not be right. I forget. SQL Server 7 is about 12 years in my past now.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply