I am new to SQL Server. Please help me to fix.
I have created a user with password in SQL Server Management Studio (2008 R2). When I use sqlcmd
with this user, sqlcmd says
C:\Console2>sqlcmd -U admin
Password:
Msg 18456, Level 14, State 1, Server machinename, Line 1
Login failed for user 'admin'.
I can access the server with this user using SQL Server Management Studio.
P.S
sqlcmd
and execute select @@version
query, it always says 2012, even I am connecting 2008 R2's sqlcmd
.It is possible that you have multiple server instances on your computer. Some MS products install the SQL Server Developer edition unless you explicitly tell it not to. So, unless you are explicitly telling sqlcmd
which instance to connect to, it may be connecting to something you aren't expecting.
sqlcmd -S servername -d database name -U id