|
1 | 1 | # Get Started with mssql-scripter
|
2 | 2 |
|
3 |
| -mssql-scripter is the multiplatform command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. |
| 3 | +mssql-scripter is the command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. |
4 | 4 |
|
5 |
| -You can use mssql-scripter on Linux, macOS, and Windows to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard *nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. |
| 5 | +You can use mssql-scripter on Linux, macOS, Windows, and the Azure Cloud Shell to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard *nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. |
6 | 6 |
|
7 | 7 | ## Install
|
8 | 8 |
|
@@ -82,11 +82,19 @@ You can set environment variables for your connection string through the followi
|
82 | 82 | export MSSQL_SCRIPTER_PASSWORD='ABC123'
|
83 | 83 | mssql-scripter -S localhost -d AdventureWorks -U sa
|
84 | 84 |
|
85 |
| - ## Run your scripts using sqlcmd |
86 |
| - Now that you have generated a script for your database objects, you can execute the script using sqlcmd such as in the example below. |
| 85 | + ## Generate and run scripts |
| 86 | + In this example you will generate a script, send it to a file, and execute the script. |
87 | 87 |
|
| 88 | + Generate a script and send it to a file using mssql-scripter. |
88 | 89 | # script all the data to a file.
|
89 | 90 | mssql-scripter -S localhost -d AdventureWorks -U sa --data-only > ./adventureworks-data.sql
|
| 91 | + |
| 92 | + Now that you have generated a script for your database objects, you can execute the script using sqlcmd such as in the example below. |
| 93 | + |
| 94 | + # execute the script from the file. |
90 | 95 | sqlcmd -S localhost -d AdventureWorks -U sa -i`./adventureworks-data.sql
|
91 | 96 |
|
92 | 97 | You can find more details on using sqlcmd [here](https://docs.microsoft.com/en-us/sql/relational-databases/scripting/sqlcmd-use-the-utility).
|
| 98 | + |
| 99 | +## Use mssql-scripter in the Cloud Shell |
| 100 | +You can use mssql-scripter in the Azure Cloud Shell to generate scripter for Azure SQL DB, Azure SQL DW, and SQL Server instances in Azure VMs. [Connect to the Azure Cloud Shell](https://docs.microsoft.com/en-us/azure/cloud-shell/overview?view=azure-cli-latest). Once connected, you can use mssql-scripter in the terminal as you would in a local terminal. |
0 commit comments