Friday, February 17, 2012

Error while Inserting!

Hey folks,
I am trying to updat a table by inserting values from another table into the parent table. The SQL being used is:
"insert into "LogSchema"."_rt1182" select * from "LogSchema"."_rt557" where recordID not in (select * from "LogSchema"."_rt1182") ORDER BY TIMESTAMP"
I have used the above statement and was successful, but with these two particluar tables I am getting an error message" Wrong number of values to INSERT"
Please lemme know, what this means and how to correct this problem!
TIAYou've used this code, and it worked at least once?

-PatP|||Originally posted by Pat Phelan
You've used this code, and it worked at least once?

-PatP
Yes the code worked for other tables, but am facing the problem with these two particluar tables namely _rt1182 and _rt557!
Any thoughts?
TIA|||How about this:

insert into [LogSchema].[_rt1182] (<put_your_field_list_here>) select <put_your_field_list_here> from [LogSchema].[_rt557] r1 left outer join [LogSchema].[_rt1182] r2 on r1.recordID = r2.recordID where r2.recordID is null ORDER BY TIMESTAMP

No comments:

Post a Comment