Guest_imported
New member
- Jan 1, 1970
- 0
The syntax checker in Query analyzer is preventing me from performing a series of steps, when the second step relies on the results of the first step. Example:
select * into step1_out from step1_in where [condition]
select keyfield, count(*) into step2_out from step1_out
Query analyzer will give me an error saying that object step1_out does not exist.
This doesn't work either:
begin transaction
select * into step1_out from step1_in where [condition]
drop table step1_in
committ transaction
begin transaction
sp_rename step1_out, step1_in
committ transaction
begin transaction
select keyfield, count(*) into step2_out from step1_in
drop table step1_in
committ transaction
begin transaction
sp_rename step1_out, step1_in
committ transaction
Query analyzer gives me an error with sp_rename.
My immediate problem is that I need to add collumns to a table through a series of joins, dropping the input table and renaming the output table after each step. Since these are big tables I would like to automate this in a batch. How can I do this?
select * into step1_out from step1_in where [condition]
select keyfield, count(*) into step2_out from step1_out
Query analyzer will give me an error saying that object step1_out does not exist.
This doesn't work either:
begin transaction
select * into step1_out from step1_in where [condition]
drop table step1_in
committ transaction
begin transaction
sp_rename step1_out, step1_in
committ transaction
begin transaction
select keyfield, count(*) into step2_out from step1_in
drop table step1_in
committ transaction
begin transaction
sp_rename step1_out, step1_in
committ transaction
Query analyzer gives me an error with sp_rename.
My immediate problem is that I need to add collumns to a table through a series of joins, dropping the input table and renaming the output table after each step. Since these are big tables I would like to automate this in a batch. How can I do this?