Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Verify a Login name with SQLCMD Tool?

The quickest way to verify a login name on a SQL Server is probably to use the SQLCMD tool, which takes the server name, login name and password in a single command line. Here is how to try it yourself:

Start a command window and enter the following command:

C:>SQLCMD -S LOCALHOSTSQLEXPRESS -U ggl_DBA -P ABD_LGG

1> PRINT Suser_Sname();

2> GO

ggl_DBA

1> QUIT

C:>

This shows ggl_DBA is a valid login and the password is correct. Now try this command:

C:>SQLCMD -S LOCALHOSTSQLEXPRESS -U ggl_DEV -P ABD_LGG

Msg 18456, Level 14, State 1, Server LOCALHOSTSQLEXPRESS, Line 1

Login failed for user 'ggl_DEV'.

C:>

This shows ggl_DEV is not a valid login or the password is incorrect.

 140 views

More Questions for you: