SQL is not like "exactly" like Access where you can base queries off of other queries. But what you can do is combine these three steps into one procedure.
How I see it you have a couple choices. First, is to build all these as one big select with subqueries. Like a so...
CREATE PROCEDURE...
I'm not exactly sure what you want to do with the variable @MessageBody but the code below will print out the results of the query. You'll basically have to load the query results into a cursor and add them to the variable. If you lets us know what your going to do with the variable @MessageBody...
Ok, try this out. In sp2's parameter declartions type this;
create procedure sp2
@RETURN_VALUE varchar(50) output
as
/rest of procs code
set @RETURN_VALUE = @test_codes
Declare a variable in sp1 to hold the text and use the following line when calling sp2 to bring back the string...
try this one out
select dbo.TravelerLot.LotID, dbo.TravelerLot.TravLotID, min(dbo.Process.ProcNum)
from dbo.TravelerLot
inner join dbo.Process on
dbo.Process.ProcNum = dbo.TravelerLot.ProcId
group by dbo.TravelerLot.LotID, dbo.TravelerLot.TravLotID
How about just importing the raw data into a table in your database using dts first. Once the data is in this "temporary" table you can modify the procedure you have right now to look at the new table.
This does add a step to the process but it may cut down on the amount of time overall since...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.