paraglidersd
Programmer
m pretty inexperienced when it comes to sql, but I am an experienced engineer.
Want to create a stored procedure. Within that procedure I am going to create a temp table with certain attributes read in from 2 other permanent tables. After that, within the stored procedure, I want to read the resulting rows of the temp table one by one (one of the attributes will be a key that I will use to access yet another permanent table). I dont know how to do this.
select key1, att1 into #temp_table
from permTable1
where
key > xx
date > 999999
insert #temp_table
select key1, att1 from permTable1History
where
key > xx
date > 999999
....this is where I am stuck....how do I now read the contents of the #temp_table within the stored procedure one by one, to pull out that key attribute, to use to read from another permanent table?
would it be
select * from temp_table
(select id from permTable3 where exists)......blah blah...?
thanks,
Bill
Want to create a stored procedure. Within that procedure I am going to create a temp table with certain attributes read in from 2 other permanent tables. After that, within the stored procedure, I want to read the resulting rows of the temp table one by one (one of the attributes will be a key that I will use to access yet another permanent table). I dont know how to do this.
select key1, att1 into #temp_table
from permTable1
where
key > xx
date > 999999
insert #temp_table
select key1, att1 from permTable1History
where
key > xx
date > 999999
....this is where I am stuck....how do I now read the contents of the #temp_table within the stored procedure one by one, to pull out that key attribute, to use to read from another permanent table?
would it be
select * from temp_table
(select id from permTable3 where exists)......blah blah...?
thanks,
Bill