Do you know a reliable command line tool able to export SQL Server schema to a text file?
Export SQL Server data by using the SQL Server Import and Export Wizard. The SQL Server Import and Export Wizard allowing users to copied data from and to data sources. This Wizard can be opened in two ways, through SQL Server Management Studio, or a stand-alone application through the Start menu.
You can do this with mssql-scripter. Download through - pip install mssql-scripter
.
The command you'll want to use is along the lines of:
$ mssql-scripter -S serverName -d databaseName -U user > ./my-schema.sql
The default is schema only (you can also specify --schema-and-data
and --data-only
). The command line will prompt for your password.
And you can pipe to stdout, sed, or a .sql file currently. Here's the GitHub page as this is an OSS repo - https://github.com/Microsoft/mssql-scripter. Please do file issues on the repo if you run into any.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With