I have this command that found on the MSDN. but it throws syntax error. Is there any keywords that i missed? I have read many forums but couldn't find the solution. I also visit guide on MSDN. but nothings happen.
sqlcmd -S SERVER\SQL2008R2 -i sqlfile.sql
You need to run this on Command Prompt
and not inside sqlcmd
:
sqlcmd -S SERVER\SQL2008R2 -U UserName -P Password -i sqlfile.sql
i.e. C:\>sqlcmd -S SERVER\SQL2008R2 -U UserName -P Password -i sqlfile.sql