The project now has a new home on GitHub

Follow here: https://github.com/TheCodeKing/SqlHarvester.Net

Usage

Where not specified on the command-line the default SqlHarvester settings can be configured using the SqlHarvester.exe.config file.
SqlHarvester [-export|-import] [<option>]
    -export    
              Exports content from the target database.
    -import   
              Imports content into the target database.

Options:
    -connectionString:<connectionString>
              The connection-string used to connect to the target database.

    -tables[:tableExpression1,[:tableExpression2], ...]
              Defines one or more tables from which to script content.

    -defaultScriptMode:[NotSet|Delete|NoDelete]
              Specifies if content is scripted with deletes by default.
    
    -outputDirectory:<filePath>
              The location of script files for scripting or seeding.

   -verbose:<level>
              Specifies the output verbose level (0-4). 


Examples

The following scripts content from the table TableA where it meets the condition TableId>10. Any existing content not matching this criteria in the target database will be deleted when the script is imported.
SqlHarvester -export -tables:"TableA Where TableId>10 With Delete"

The following scripts content from table TableA where it meets the condition TableId>10. When imported the scripted content will be merged with any existing content. Existing rows will be updated, missing rows will be inserted.
SqlHarvester -export -tables:"TableA Where TableId>10 With NoDelete"

The following scripts content from the table TableA, TableB and TableC. Each table has a different delete mode and filter specified. The verbose mode is set to 3.
SqlHarvester -export -tables:"TableA With NoDelete":"TableB":"TableC Where ColumnB='A' With NoDelete" -verbose:3

The following scripts content from all user-database-tables. The * wildcard may also be used when defining tables in the configuration file.
SqlHarvester -export -tables:"*"

The following imports pre-scripted content from the output directory into the Demo database. Data is imported within a transaction and rolls back on error. Database constraints are disabled during the import process.
SqlHarvester -import -connectionString:"data source=(local);Integrated Security=SSPI;Initial Catalog=Demo"

The following imports pre-scripted content from the specified directory SqlScripts, into the default target database defined in the configuration file. Any files with the Sql extension within this directory will be imported.
SqlHarvester -import -outputDirectory:"C:\SqlScripts"

Last edited Jul 16, 2011 at 3:15 PM by beelineuk, version 2

Comments

No comments yet.