What is the wrong with this SQL?

From: Ram Kumar Koditala (RamKumarKoditala_at_discussions.microsoft.com)
Date: 11/12/04


Date: Fri, 12 Nov 2004 08:55:06 -0800

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



Relevant Pages

  • RE: What is the wrong with this SQL?
    ... > (col1 int ... > insert into src values ...
    (microsoft.public.sqlserver.programming)
  • Re: Range query optimization help?
    ... (src, amp, asof) ... >unique clustered index asof_src on MeterEvent ... >table StdAmp, minamp int, maxamp int, stdval int) ...
    (microsoft.public.sqlserver.programming)
  • Re: strcpy() - dangerous? [Was Re: gets() - dangerous?]
    ... >>>It's more easy to enforce a coding rule regarding string copying ... >>>strcpy correctly I will need to program a call to strncpy anyway ... >>>if the length of src gets ... Here's the corrected version that still uses int. ...
    (comp.lang.c)
  • Re: Cant find PInvoke DLL - BUG?
    ... return uncompressCE(dest, ref destLen, src, srcLen); ... int srcLen); ... I am getting same error when using another dll - the usage is ... Is there any difference when loading library from app. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Automatic way to test performance optimizations
    ... But I would also like to test, that the optimization is used in the ... Does Sun remove all log statements from its JDK src before ... Objectdest, ... int high, ...
    (comp.lang.java.programmer)

Loading