Insert select statement and null value

Insert select statement and null value

Post by Todd Haze » Wed, 10 Nov 2004 04:12:25


I'm trying to use "INSERT INTO Columns... SELECT Columns..." and its not
inserting the rows where one of the columns in the select statement is
null. Does anyone know why this might be happening? I have been trying
to use a case statement to change the null value to a string but this
also doesn't solve the problem. If it makes any difference the column
with the null value is part of a unique index that consists of 8 columns.

Regards,

Todd
 
 
 

Insert select statement and null value

Post by Armando Pr » Wed, 10 Nov 2004 04:16:39

Could you show us the query and DDL?

My guess is it's a mapping problem between the columns in the INSERT list
and the columns in the SELECT list. I'd look them over carefully.

 
 
 

Insert select statement and null value

Post by Todd Haze » Wed, 10 Nov 2004 11:07:06

Well, I did manage a temperary fix to the problem. I just set the value
for every record in the table for the problem column to an ampty string
and it fixed the insert problem. Why this fixed it I don't know because
I have other columns that are null and they insert properly. The only
difference I know of is that the records that do insert properly are not
part of a unique constraint.

Todd
 
 
 

Insert select statement and null value

Post by Joe Celk » Wed, 10 Nov 2004 12:50:40

Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.

Did it ever occur to you just how hard it is to debug code without
seeing it????

*** Sent via Developersdex http://www.yqcomputer.com/ ***
Don't just participate in USENET...get rewarded for it!