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.
Asked
Active
Viewed 290 times
1 Answers
1
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.

Dibakar Paul
- 166
- 11

Lithin Kuriachan
- 43
- 8
-
Can you please explain me how can I get the InstanceName here? – Sarah117 May 16 '16 at 09:39
-
it is your Database instance name eg :- 'database1' – Lithin Kuriachan May 16 '16 at 09:43
-
Thanks. But how do you know whether your sql commands have worked properly? – Sarah117 May 16 '16 at 09:55