This PR is a partial merge of PR #319, which rounds out the "use" scenario for containers, to allow the casual user who doesn't know containers/linux well, to be able to get going quickly with already existing databases.
This PR adds supports for local files (remote http(s) was already supported), and .mdf files, and adds the sqlcmd use sub-command. To follow later will be .bacpac support, and compressed file support. (there are issues right now with these features, in how to reliably do them with the existing mssql container structure)
--use now supports local and remote files
sqlcmd create mssql --use [<local file>|<remote file>]
The T/SQL database name by default becomes the --use file name (without extension). This can be overridden with a ",", e.g.
This will result in the restored database being named [adventure_works] instead of [AdventureWorksLT]
--use now supports .mdf and .bak files
sqlcmd create mssql --use [.mdf|.bak]
the new sqlcmd use subcommand allows all of the above, to add a database to an already existing container
sqlcmd use [<local file>|<remote file>]
Examples:
sqlcmd install mssql --accept-eula
# Restore a backup (override database name to be [adventure_works], instead of [AdventureWorksLT])
sqlcmd use https://aka.ms/AdventureWorksLT.bak,adventure_works
sqlcmd query "DROP DATABASE [adventure_works]"
sqlcmd use c:\Users\alias\Downloads\AdventureWorksLT.bak,adventure_works
DRAFT: Not ready for code review yet.
This PR is a partial merge of PR #319, which rounds out the "use" scenario for containers, to allow the casual user who doesn't know containers/linux well, to be able to get going quickly with already existing databases.
This PR adds supports for local files (remote http(s) was already supported), and .mdf files, and adds the
sqlcmd use
sub-command. To follow later will be .bacpac support, and compressed file support. (there are issues right now with these features, in how to reliably do them with the existing mssql container structure)sqlcmd create mssql --use [<local file>|<remote file>]
The T/SQL database name by default becomes the --use file name (without extension). This can be overridden with a ",", e.g.
This will result in the restored database being named [adventure_works] instead of [AdventureWorksLT]
--use now supports .mdf and .bak files
sqlcmd create mssql --use [.mdf|.bak]
the new
sqlcmd use
subcommand allows all of the above, to add a database to an already existing containersqlcmd use [<local file>|<remote file>]
Examples: