1

i want to execute a .sql file from cmd. Here's my command :


sqlcmd -e -S "(localdb)\myDB" -i "C:\PathToMyFile\File.sql" -U user -P password


Here's my errors :


Errors


Microsoft ODBC Driver 13.1 is installed. Someone knows what I've done wrong? Thx.

6
  • can you go to sql server configuration manager and make sure SQL Server (MSSQLSERVER) is running? in addition: stackoverflow.com/questions/30953100/… Commented Feb 6, 2018 at 19:57
  • It's never a good idea to post an image of your errors. You'll do much better here to put the error text here, even if you have to re-type it. Commented Feb 6, 2018 at 20:19
  • @JoelCoehoorn why it is not good idea? Commented Feb 6, 2018 at 20:23
  • 1
    @ErayBalkanli Lot's of people will never see that image or choose not to bother with it. Using an image instead of text limits the number of people who might have helped you. Commented Feb 6, 2018 at 20:38
  • 2
    It also won't come up in google searches, so the overall quality of StackOverflow as a resource is lower. Commented Feb 6, 2018 at 21:05

1 Answer 1

2

You are using the wrong server name:

sqlcmd -e -S "(localdb)\mssqllocaldb" -d MyDB -i "C:\PathToMyFile\File.sql" -U user -P password

or with Integrated Authentication:

sqlcmd -e -S "(localdb)\mssqllocaldb" -d MyDB -i "C:\PathToMyFile\File.sql" -E
Sign up to request clarification or add additional context in comments.

1 Comment

Yea that's it ! Thx :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.