SQL Server Management Studio Connect to Another Database using :Connect

Nemo1234567 1 Reputation point
2022-03-22T06:40:43.757+00:00

Hi,

Using SQL Server Management Studio, I'm able to connect to a database by using the GUI as below
185439-image.png

But I'm unable to do so by executing ":connect". I've turned on the SQLCMD mode. I'm not sure whether is it because I didn't specify the authentication mode. If this is required, pls kindly let me know the syntax. Thks!

185512-image.png

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 43,246 Reputation points
    2022-03-22T08:55:53.55+00:00

    In SSMS you used "Azure Active Directory" authentication.
    I couldn't test it, but in SqlCmd see you have to add parameter -G (use Azure Active Directory for authentication)
    See https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15#syntax

    0 comments No comments

  2. Nemo1234567 1 Reputation point
    2022-03-23T07:40:15.697+00:00

    I've appended "-G" at the end of the command but it didn't work as well

    185946-image.png

    The error is as below
    185930-image.png

    0 comments No comments