3

I am trying to run a sql file located at /desktop/folder/query.sql in command line. I have the database changed to the one that I need but am unsure how to execute the file. Thanks in advance for any help

4

2 Answers 2

5

answering my own question,

mysql> source desktop/folder/query.sql;

Just had to use the 'source' prefix.

Sign up to request clarification or add additional context in comments.

1 Comment

Which is where i found it. Thanks for the link, and the downvote
0

Goto the File Path And then on Address bar of system hit ENTER then you will get redirect to cmd to that path: Then Runt Above command With Your Details like your Server Name/Instance Name then Filename with extention of .sql and in last add databse name.

sqlcmd -S myServer\instanceName -i C:\myScript.sql -d Database

Eg: sqlcmd -S DESKTOP-E73MBC3 -i sampleDBData.sql -d First_DB

Comments

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.