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
 SQL Server Development (2000)
 Query in a query

Author  Topic 

odec
Starting Member

2 Posts

Posted - 2002-03-14 : 04:26:34
Hi,
we are managing a db and we're wondering of we can call
our query files from a query?
Kind of in a query we call the query's we have made to maintain
the db.
thx



Edited by - odec on 03/14/2002 04:27:17

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-03-14 : 05:20:16
Hi

Have you looked at Stored Procedures ? They sound perfect for what you want to do.

Damian
Go to Top of Page

odec
Starting Member

2 Posts

Posted - 2002-03-14 : 06:50:03
we have made multiple scripts/querys and we want to call them all from one query/script.

Go to Top of Page

Teroman
Posting Yak Master

115 Posts

Posted - 2002-03-14 : 06:55:06
i think you need to create a procedure that calls others, for example

create procedure proc1
as
select 1
go
create procedure proc2
as
select 2
go
create procedure proc3
as
exec proc1
exec proc2
go

exec proc3

go

drop procedure proc1
drop procedure proc2
drop procedure proc3

go


Go to Top of Page

joldham
Wiseass Yak Posting Master

300 Posts

Posted - 2002-03-14 : 07:55:31
Not sure exactly what odec means. Do you want to Open and run a .sql file located on the server from a SP? I would be interested in anyones ideas on how to do this. Possibly through a DTS package?

Jeremy

Go to Top of Page

ToddV
Posting Yak Master

218 Posts

Posted - 2002-03-14 : 09:04:07
You can run scripts with osql, but i am not conviced this is what you are looking for. Check BOL osql

Go to Top of Page
   

- Advertisement -