-
Notifications
You must be signed in to change notification settings - Fork 74
Add --database flag to sqlcmd query #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --database flag to sqlcmd query #288
Conversation
is there no way to put the database name in the endpoint in the config? How does this path implement the hierarchy of command line switch -> environment variable -> config file? In reply to: 1458373819 Refers to: internal/sql/mssql.go:37 in f632d34. [](commit_id = f632d34, deletion_comment = False) |
I've added an issue to enable database name to be added to sqlconfig file In reply to: 1458373819 Refers to: internal/sql/mssql.go:37 in f632d34. [](commit_id = f632d34, deletion_comment = False) |
…s://github.com/microsoft/go-sqlcmd into stuartpa/add-database-flag-on-query-subcommand
This closes #287
For
sqlcmd create
scenario the default_database is set on the user login (in the master database attached to the sqlserver in the container). This means the default_database isn't stored in the sqlconfig file. (this also means we don't have to deal with this value getting out-of-sync between the sqlconfig file and the container instance)However, a user might delete their default database, which then prevents connecting without specifying a different database (master), to change the default database (this PR also added a # Example on how to do this)
The user might also just want to query a non-default database.
With this PR the user can do
sqlcmd query "PRINT DB_NAME" --database some-other-database