Re: What is the wrong with this SQL?
From: Gert-Jan Strik (sorry_at_toomuchspamalready.nl)
Date: 11/12/04
- Next message: Tim S: "Re: dynamic sql question"
- Previous message: whornak: "EXEC(sqlstatement) Resultset usage"
- In reply to: Ram Kumar Koditala: "What is the wrong with this SQL?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Nov 2004 19:06:21 +0100
Insert a "GO" before the alter table lines
HTH,
Gert-Jan
Ram Kumar Koditala wrote:
>
> When I run the following SQL
>
> create table dest
> (col1 int
> ,col2 int
> ,col3 int
> )
> go
> create table src
> (col1 int
> ,col2 int
> ,col3 int
> )
> go
>
> print ('insert')
> insert into src values(1,2,3)
> go
>
> begin tran
> update src
> set col1 = col2
>
> insert into dest
> select col1, col2, col3 from src
> commit tran
>
> print ('Drop')
>
> -- the following needs to be done if the above trans goes well
> alter table src drop column col2
> alter table src drop column col3
>
> there is an error saying that …
>
> Server: Msg 207, Level 16, State 3, Line 6
> Invalid column name 'col2'.
>
> When I double click on the error row the cursor is going to the SQL
> statement where data is inserted from src to dest
>
> Thanks for your help
- Next message: Tim S: "Re: dynamic sql question"
- Previous message: whornak: "EXEC(sqlstatement) Resultset usage"
- In reply to: Ram Kumar Koditala: "What is the wrong with this SQL?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|