How to ensure non-null duplicate values are not inserted in SQL Server 2005 -


i have history database in sql server 2005 used archive data live database. need add column in history database named rowid int. column cannot made identity since need store values live database.

note: in live database rowid identity column. column added me in live database recently.

i need make sure in history database, non-null values inserted column unique. understand in sql server, cannot make nullable column unique.

so, in sql server 2005, efficient way make sure insertion of non-null duplicate values rowid columns throws error?

this long comment. time upgrade more recent version of sql server. microsoft discontinuing support in april (2016) (see here).

starting in sql server 2008, can trivially want filtered unique index:

create unique index unq_history_rowid on history(rowid) col not null; 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -