Hi,
I am executing a query to a DB running sql server 2000 from a C# program. I am creating a table by copying another table's columns into it, adding 2 columns to the table, and then trying to select the field from that newly created table. For some reason, if I try to do this all with one line of SQL, it fails to recognize the columns that I added (invalid column name error), but if I run the SQL in two seperate executions it recognizes the columns I added. Any help would be much appreciated, here is the SQL:
I am executing a query to a DB running sql server 2000 from a C# program. I am creating a table by copying another table's columns into it, adding 2 columns to the table, and then trying to select the field from that newly created table. For some reason, if I try to do this all with one line of SQL, it fails to recognize the columns that I added (invalid column name error), but if I run the SQL in two seperate executions it recognizes the columns I added. Any help would be much appreciated, here is the SQL:
Code:
SELECT * INTO tempjoin FROM TICKETS WHERE RECNUM = 0 ALTER TABLE tempjoin ADD NOTE varchar(60) ALTER TABLE tempjoin ADD TYPE varchar(3) SELECT NOTE FROM tempjoin
Comment