microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
334 stars 58 forks source link

Prefix @@servername of docker-instance with something more meaningful #259

Open apoorvdeshmukh opened 1 year ago

apoorvdeshmukh commented 1 year ago

With the ability to create docker instance via sqlcmd, I think there should also be some mechanism to confirm if user is connected to the docker instance created via sqlcmd or some other sql server instance post establishing connection. One way to do this is by running select @@servername which displays only hash. I wonder if labeling it something like sqlcmd-mssql-65f98dde9a9d would make more sense to distinguish itself.

1> select @@servername
2> go

--------------------------------------------------------------------------------------------------------------------------------
65f98dde9a9d

(1 row affected)

Opening this issue to investigate efforts required to achieve this.

stuartpa commented 1 year ago

There are some switches that enable the user to have some control over this, but I agree the default from the container runtime creates these not useful @@SERVERNAME

C:\src\go-sqlcmd\cmd\modern>sqlcmd create mssql --accept-eula --name mssql2 --hostname mssql2 C:\src\go-sqlcmd\cmd\modern> sqlcmd query "SELECT @@SERVERNAME"


mssql2

(1 row affected)