Can I write SQL insert, update and delete commands in a batch file? If I can do so can someone give me an example please.
1 Answer
write the sql code and save as .sql extension. (code.sql)
then call it from a batch file,
eg
@echo off
sqlcmd -S <ComputerName>\<InstanceName> -i code.sql
Save this as a *.bat file.
3 Comments
Sarah117
Can you please explain me how can I get the InstanceName here?
Lithin Kuriachan
it is your Database instance name eg :- 'database1'
Sarah117
Thanks. But how do you know whether your sql commands have worked properly?