1

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 1

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.

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

3 Comments

Can you please explain me how can I get the InstanceName here?
it is your Database instance name eg :- 'database1'
Thanks. But how do you know whether your sql commands have worked properly?

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.