Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing many .sql scripts

Status
Not open for further replies.

c567591

MIS
Aug 12, 2002
67
US
Our Database is being created by a batch file, where each script is fired off separately via osql each time.
There are 940 tables plus all the stored procs and triggers and views.

Example:
set @osqlcommand = 'osql -d ASCEND -USA -P'+ @SAPASSWORD + ' -i ' + '"'
set @instatement = @RUNDIR + '\Init\MSSQL\MSSQLInit.sql'
set @instatement = @osqlcommand + @instatement + '"'
select @instatement
exec master..xp_cmdshell @instatement,no_output

This is very slow is there a better way to do this?
how can I do this without going to the shell and running osql each time?

Thanks,
Matt Minnis
 
You might get a speed increase if you put all the commands together and submit them at once, instead of submitting each command one at a time.

-------------------------------------
A sacrifice is harder when no one knows you've made it.
 
Ok, I can do that.
In general is this the best way to do this?
Is there a better way?

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top