sql - Uniqueidentifier Philosophy in my scneario -
i have 3 column table none of columns unique. added id column table uniqueidentifier , made primary. 1 quesion: if 2 rows same values in columns added table, happens second one? added or not? how can avoid such things in scenario?
if 3 non-id columns not have unique constraint, , not part of primary key, can add multiple rows exact same values.
if want avoid duplicate rows, best bet apply unique constraint on @ least 1 or more of 3 columns. if can't reason, should post schema , think problem more it.
if can't use unique constraint, 1 way avoid duplicates be: when you're going insert record, first check see if record exists, , if exists, decide how want handle it.
Comments
Post a Comment