Search code examples
sqlsql-serverdatabasesqlpubwiz

Command line tool for creating script for specific MSSQL tables


I've been looking at the SqlPubWiz.exe command to write a batch file so that I can keep my script up to date in my source control. But what I need is for the command line tool to allow me to pick specific tables to include (and that I can exclude others). I think SqlPubWiz.exe won't do that for me (let me know if I'm wrong) but if someone can point me to another tool that can do it, that's what I'm looking for.


Solution

  • There are several commercial tools out there that can create database scripts, e.g.

    Here's an article showing off a free tool - however, it will only script ALL objects from your database: Eric Moreau's blog.

    If you want to "roll your own", have a look at the Server Management Objects (SMO) - those allow you to inspect your database and create scripts from them.

    See info here, here or here.

    Marc