Hello friends,
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
Rajat Jaiswal
this blog is basically for those people who want to help other and help themselves in web development.Main key feature of this blog is asp, asp.net ,Php and other web development lanaguage & Database
Sunday, February 20, 2011
Wednesday, February 16, 2011
Restore database from zip file in SQL SERVER
Recently one of my colleagues shared a link which is very useful in many ways.
http://clay.lenharts.net/blog/category/mssql-compressed-backup/
The link is very useful for restoring compressed backup. Hope this will help you also.
trust me it saved my whole day work because my production database size is 100 GB.
Thanks & Regards
Rajat Jaiswal
http://clay.lenharts.net/blog/category/mssql-compressed-backup/
The link is very useful for restoring compressed backup. Hope this will help you also.
trust me it saved my whole day work because my production database size is 100 GB.
Thanks & Regards
Rajat Jaiswal
Subscribe to:
Posts (Atom)