How To Verify a Login name with SQLCMD Tool?
Submitted by: AdministratorThe 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.
Submitted by: Administrator
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.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | How To Create a Testing Table with Test Data in MS SQL Server? |
☺ | What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
☺ | How To Create a Large Table with Random Data for Index Testing in MS SQL Server? |
☺ | How To Convert a Numeric Expression from One Data Type to Another? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |