# generate DDL scripts for all objects in the Adventureworks database and save the script to a file mssql-scripter -S localhost -d AdventureWorks -U sa # alternatively, specify the schema only flag to generate DDL scripts for all objects in the Adventureworks database and save the script to a file mssql-scripter -S localhost -d AdventureWorks -U sa --schema-only
Dump database object data
# generate DDL scripts for all objects in the Adventureworks database and save the script to a file mssql-scripter -S localhost -d AdventureWorks -U sa --data-only
Dump the database object schema and data
# script the database schema and data to a file. mssql-scripter -S localhost -d AdventureWorks -U sa --schema-and-data > ./adventureworks.sql # execute the generated above script with sqlcmd sqlcmd -S mytestserver -U sa -i ./adventureworks.sql
Include database objects
# generate DDL scripts for objects that contain 'Employee' in their name to stdout mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects Employee # generate DDL scripts for the dbo schema and pipe the output to a file mssql-scripter -S localhost -d AdventureWorks -U sa --include-objects dbo. > ./dboschema.sql
Exclude database objects