To run a query in sqlcmd, not a file, you use "-Q". See:
https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15
SQLCMD -S .\sepidar009 -Q "UPDATE......"
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hello my friends .. if any windows have not ssms i ask that we can change database in cmd by this code:
sqlcmd -S myServer\instanceName -i C:\myScript.sql -o C:\EmpAdds.txt
but when i use this in cmd i have a error that say :
Could not find files for the given pattern(s).
for example this below code is my script that i write in ssms and change my database but when i test in cmd i have that error
UPDATE [fmk].[user] set [Password]='212-29-140-217-143-0-178-4-233-128-9-152-236-248-66' where UserID='1'
i think that i had bad replace and do it wrong.
thanks for your answers my friend.
To run a query in sqlcmd, not a file, you use "-Q". See:
https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver15
SQLCMD -S .\sepidar009 -Q "UPDATE......"
Hi @gholamreza rezaie ,
Could not find files for the given pattern(s)
You need enclose the command in "……“(double quotes), otherwise the script will not run
USING SQLCMD UTILITY TO RUN SQL STATEMENTS FROM COMMAND LINE
-------------
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.