tsql - t-sql NOT IN with multiple columns -
I have a Microsoft SQL database, where I am trying to insert some data. I have a unique key on 4 columns and I want to insert data from several tables in this table, checking for data, to make sure it does not violate the key specification. If I was doing it on a column, I would not do it like this ..
INSERT TABLE_A (FLD_1) SELECT FLD_1 to TBL_B Inner TBL_C at TBL_B.FLD_1 = TBL_C. FLD_1 Where TBL_B.FLD_1 (Select TBL_A.FLD_1 from TBL_A)
Any ideas? Instead of dealing with many columns, use it instead of
instead. Edit:
Edit:
Untested, but roughly this would be:
TBL_B Select from interiors FLD_1 Join TBL_B.FLD_1 = TBL_C.FLD_1 at TBL_C (TBL_A from within TBL_A.FLD_1 selection but TBL_B.FLD1 = TBL_A.FLD1 TBL_B) for a multi-purpose It will be broadly examined by checking the column: FLD_1, FLD_2, FLD_3, FLD_4) Select TBL_B from within TBL_C at TBL_B.FLD_1 = TBL_C.FLD_1 where it does not exist (Select TBL_A.FLD_1, TBL_A.FLD_2, TBL_A.FLD_3, TBL_A.FLD_4 TBL_A INB at TBL_ B.FLD1 = TBL_ A.F.L.D.DA. and TBL_F.F.D.D. 2 = TBLAFFDD2 and TBLBAFDD3 = TBL_A.FLD3 and TBBBFD4 = TBL_A.FLD4)
Comments
Post a Comment