i want to to add a constraint onto a ID column and a date time column, so that an id can only be entered once in a day
alter table Table1
...
add constraint pk_id Primary Key (datetime,ID)
If an id
has been inserted for the following datetime 2015-03-17 12:48:00
, it would not get inserted again on the same datetime, but if the time changes to 2015-03-17 12:45:00
the id
gets entered again.
Is there a way to add the constraint to just the date part of the datetime column?