How To Verify a User name with SQLCMD Tool?

Submitted by: Administrator
The quickest way to verify a user name in a database is probably to use the SQLCMD tool. You can connect to the server, select the database, and check which user name is linked the current login name as shown below.

Start a command window and enter the following command:

C:>SQLCMD -S LOCALHOSTSQLEXPRESS -U ggl_Login -P IYF
1> USE GlobalGuideLineDatabase;
2> GO
Changed database context to 'GlobalGuideLineDatabase'.

1> PRINT User_Name();
2> GO
ggl_User

This shows user "ggl_User" in database "GlobalGuideLineDatabase" is linked to login name "ggl_Login".
Submitted by: Administrator

Read Online MS SQL Server Job Interview Questions And Answers