sam2929
asked on
update stmt
Hi,
I have two tables
Bridge_AA
id key start_dte end_dt camp_id
123 104 Aug-10-2012 dec-30-3030 102
123 104 Aug-10-2012 dec-30-3030 103
123 104 Aug-10-2012 dec-30-3030 104
dim_bb
id_bb key_bb start_dte end_dt identy_key flag
123 104 Aug-10-2012 sep-6-2012 234 N
234 104 sep-7-2012 dec-30-3030 y
we need to update Bridge_aa id and end_dt based upon the identy_key (234) as this is new id_bb row going forward as 123 has expired
so final look after update should be
Bridge_AA
id key start_dte end_dt camp_id
234 104 Aug-10-2012 sep-6-2012 102
234 104 Aug-10-2012 sep-6-2012 103
234 104 Aug-10-2012 sep-6-2012 104
I have two tables
Bridge_AA
id key start_dte end_dt camp_id
123 104 Aug-10-2012 dec-30-3030 102
123 104 Aug-10-2012 dec-30-3030 103
123 104 Aug-10-2012 dec-30-3030 104
dim_bb
id_bb key_bb start_dte end_dt identy_key flag
123 104 Aug-10-2012 sep-6-2012 234 N
234 104 sep-7-2012 dec-30-3030 y
we need to update Bridge_aa id and end_dt based upon the identy_key (234) as this is new id_bb row going forward as 123 has expired
so final look after update should be
Bridge_AA
id key start_dte end_dt camp_id
234 104 Aug-10-2012 sep-6-2012 102
234 104 Aug-10-2012 sep-6-2012 103
234 104 Aug-10-2012 sep-6-2012 104
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
problem in this update i get below error
but t2.id_bb and set id both are not null but identity_key is not null is that causing the issue?
SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=3, TABLEID=538, COLNO=8 " is not allowed.
Explanation:
One of the following occurred:
but t2.id_bb and set id both are not null but identity_key is not null is that causing the issue?
SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=3, TABLEID=538, COLNO=8 " is not allowed.
Explanation:
One of the following occurred:
null means the subquery did not return a match so there is something wrong with your data
http://www.w3schools.com/sql/sql_foreignkey.asp