Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 running large number of sql scripts

Author  Topic 

rum23
Yak Posting Veteran

77 Posts

Posted - 2009-01-26 : 11:03:15

I have 50+ sql scripts files that contains changes to the database. Right now, I open each sql script file in the query analyzer and execute it which can be tedious. Is there a way to run these sqlscripts from a MS-DOS batch file? If so, please let me know how. Thanks a lot for your help.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-01-26 : 12:11:42
Here comes an old batch-code i have used in the past.
setlocal
SET ISQL=isql -Smyserver -dmydatabase -Umyuser -Pmypassword
for %%d in (*.sql) do %ISQL% -i%%d -n
endlocal


Hope that helps
Webfred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

heavymind
Posting Yak Master

115 Posts

Posted - 2009-01-27 : 07:59:31
Probably the only change would be to use sqlcmd instead of old isql...

Thanks, Vadym
MCITP DBA 2005/2008
Chief DBA at http://www.db-staff.com
Go to Top of Page
   

- Advertisement -