Skip to content

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

Merged
merged 15 commits into from
Mar 10, 2023

Conversation

stuartpa
Copy link
Collaborator

@stuartpa stuartpa commented Mar 7, 2023

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

@shueybubbles
Copy link
Collaborator

shueybubbles commented Mar 7, 2023

  	endpoint.EndpointDetails.Address,

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)

@stuartpa
Copy link
Collaborator Author

  	endpoint.EndpointDetails.Address,

I've added an issue to enable database name to be added to sqlconfig file

#297


In reply to: 1458373819


Refers to: internal/sql/mssql.go:37 in f632d34. [](commit_id = f632d34, deletion_comment = False)

@stuartpa stuartpa marked this pull request as ready for review March 10, 2023 08:34
@stuartpa stuartpa requested a review from JyotikaGargg March 10, 2023 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --database flag to sqlcmd query
3 participants