Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2010-12-03 : 10:20:13
|
Can someone tell me what is wrong ? Im trying to perform an update on a table based only if the corresponding rows exist in a temp table.UPDATE TEST SET B = CASE WHEN (CASE WHEN ISNULL(S,0) <> 0 THEN G * H END) = 0 THEN NULL ELSE (G + K END) ENDFROM TEST TINNER JOIN #L TPON T.A1 =TP.A1 AND T.A2 =TP.A2 ANDT.A3 = TP.A3I get error Ambiguous column name 'G'Column G exist in both TEST & #LMeanwhile Column H,K & S only exist in TEST table |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-03 : 10:22:27
|
You need to specify the table the columns come fromTP.G or T.Gdo that for all of the columns even if they are not ambiguous to make things clear.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2010-12-03 : 11:22:34
|
Thanks folks.It worked like a charm |
 |
|
|
|
|