Skip to content

sqlcmd -L command return strange strings #474

@AnyiYang

Description

@AnyiYang

My customer runs sqlcmd -L and it returns strange string like following:

Servers:
;UID:Login ID=?;PWD:Password=?;Trusted_Connection:Use Integrated Security=?;*APP:AppName=?;*WSID:WorkStation ID=?;

The issue can be reproduced in my server with sqlcmd shipped with SQL 2019, SQL 2022. The issue also exists when I use go-sqlcmd:

C:\Windows\System32>sqlcmd -?

Version v1.4.0

C:\Windows\System32>sqlcmd -L

Servers:
;UID:Login ID=?;PWD:Password=?;Trusted_Connection:Use Integrated Security=?;*APP:AppName=?;*WSID:WorkStation ID=?;

I debuged the sqlcmd shipped with SQL 2022. The issue is that when sqlcmd tries to fetch server list from return result of SQLBrowseConnectW of driver (this is msodbcsql), it could not handling well when there is no server name between { and } in the result. But I think go-sqlcmd might not use msodbcsql. Not sure if it also hit the same string handling problem. Please help to have a check on the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions