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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a query from another query using Query Analyzer

Status
Not open for further replies.

supermama

Programmer
Sep 13, 2001
12
PY
A have read a lot and did not found how to do this.
I know I can execute a sp with exec (sp_whatever)
I just want something like that but with queries. I need to call or execute a query (*.sql) from another query code (*.sql). Something like this (guessing...!)


use pubs
select * from authors
go

call (library) --where 'library' is another query (library.sql)

Thank you for your help!!

'Love T-SQL'
 
Put whatever script is in the .sql file into a stored procedure and just call that.

--James
 
supermama


if you wish to execute sql batched in text files then I suggest you look at the osql or isql command line utilities.
 
Thank you James. That was the first thing I thought too, but I'm trying to avoid sp...

If there's no other way to do that, I will have to go to sp's...

'Love T-SQL'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top