Reputation: 39
I'm trying to import an sql file of size 3.2GB. So definitely I would need to do it using cmdsql. But the problem is that the server I'm trying to connect with in SSMS has no password and that is giving me the error. I'm usig the following command in cmd:
sqlcmd -S DESKTOP-7QKBPG7\SQLEXPRESS -d XVMS-4.6 -U CSNA\kamran.bajwa -P -i C:\Users\kamran.bajwa\Downloads\XVMS\SCHEMA-DATA-16-06-2022\SCHEMA-DATA.sql -o C:\Users\kamran.bajwa\Downloads\XVMS\SCHEMA-DATA-16-06-2022\logs.txt
As of the"-P" there is no password so if I use an empty string "" then it gives me the following error in the log file:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed for user 'CSNA\kamran.bajwa'..
Upvotes: 0
Views: 169
Reputation: 9159
You need to use windows authentication, you're trying to use sql server authentication with empty password which isn't the same, so remove the username and password parameters.
Something like:
sqlcmd -S DESKTOP-7QKBPG7\SQLEXPRESS -d XVMS-4.6 -i C:\Users\kamran.bajwa\Downloads\XVMS\SCHEMA-DATA-16-06-2022\SCHEMA-DATA.sql -o C:\Users\kamran.bajwa\Downloads\XVMS\SCHEMA-DATA-16-06-2022\logs.txt
Read more here: https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-use-utility?view=sql-server-ver16
Upvotes: 0