Question : check constraint date ranges

I have a table with a columns APPT_DATE and TIME

How can I implement a check constraint that would function like this:
CHECK (APPT_DATE  + TIME >= CURRENT_DATE + CURRENT_TIME)

Thanks

Answer : check constraint date ranges

Create the check constraint as shown

create table checktest (d datetime, t datetime)

alter table checktest add constraint ck_checktest_dt check(d+t < getdate())

insert checktest (d,t) values (GETDATE()-1,null)
insert checktest (d,t) values (null,GETDATE()-1)
insert checktest (d,t) values (null,GETDATE())
insert checktest (d,t) values (GETDATE(),'00:01')
insert checktest (d,t) values ('20100619','00:01')
insert checktest (d,t) values ('20100619','20:01')
Random Solutions  
 
programming4us programming4us