Does anyone have any idea how do i create unique index for both month and year column?
As in: JAN 2012 should be an unique index and also to aid in searching and retreiving of results by month and year.
Thanks
sql-server-2008
Does anyone have any idea how do i create unique index for both month and year column?
As in: JAN 2012 should be an unique index and also to aid in searching and retreiving of results by month and year.
Thanks
Best Answer
Assuming you have a column of type
DATE
orDATETIME2
(orDATETIME
), you can define two computed, persisted columns for year and month and put an unique index on those: