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 2000 Forums
 Transact-SQL (2000)
 Calling a sql file from Query Analyzer

Author  Topic 

laker_66
Starting Member

5 Posts

Posted - 2004-05-10 : 10:40:30
Hi,
I'm updating a database with a sql file .I was wondering how to call a sql file inside a sql file .
The sql files are used for updating databases .

Thanks!!!

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-05-10 : 11:11:56
There's no straightfoward way that I know of to do this, I'd just open each file in turn and execute them. Having said that I suppose you could look into using a combination of xp_cmdshell to shell out to a command prompt and issue an isql command that uses the /i parameter to specify the file you want to execute.


Raymond
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-05-10 : 12:31:50
Using osql will work. You just need to call it with xp_cmdshell.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

laker_66
Starting Member

5 Posts

Posted - 2004-05-10 : 16:19:47
OSQL did the work . I did try to use xp_cmdshell but i had some permission issues.
Thanks!!!
Go to Top of Page
   

- Advertisement -