Batch files many times reduce our work. Many tables, stored procedures, functions times we need to create same database, tables, stored procedures, and pre pop data on multiple instances or even same environment. Then in that case we just create scripts and run again and again in SQL Management Studio. But if you are in hurry and you want to run the script on single click without opening file then the easiest way is use ” ISQLW” .isqlw is the another way and we can use it with batch file.
So here are the basic steps:-
Suppose I want to create friends DB database with all theand pre pop data.
Then step 1:- Generate, a script file in which we will keep all the create table’s statements, create procedures statements and pre pop scripts.
Step2:- create a batch file for this just open notepad and save the file with extension “.bat” then the file is saved as batch file. (A batch file is executable file)
Step 3: Just write isqlw command in that as shown below
IsqlW -E -i “\fdb.sql” -o “\rajat.txt”
Where -I switch for input file – o for output file. With isqlw you can give credential also but my sql server is with mix mode so there is no problem.
After writing isqlw statement just save it and run it will create database FriendDB with all the tables, stored procedures and prepop data.
And the entire log will register in rajat.txt file.
In this way you can enjoy one click database creation with all tables’ stored procedures and pre pop data.
Thanks & Esteemed Regards