I am using this code to insert starttime and endtime.
INSERT
INTO working_schedule (id_number, starttime, endtime, created_user, created_pc, created_version, created_domain, created_os, created_workingset) VALUES(@id_number, @starttime, @endtime, @created_user, @created_pc, @created_version, @created_domain, @created_os, @created_workingset)
and this code to check for duplicate before inserting..
IF
EXISTS (SELECT id_number, starttime, endtime FROM working_schedule WHERE id_number = @id_number AND starttime = @starttime AND endtime = @endtime)
but it's checking the seconds as well..
how can i only check date, hour and minutes (without the seconds

how can i check date, hour and minutes only?
cwinfough
Use the datediff function:
SELECT id_number, starttime, endtime FROM working_schedule
WHERE id_number = @id_number
AND DATEDIFF(mi,starttime,@starttime) = 0
AND DATEDIFF(mi,endtime,@endtime) = 0
HTH, Jens K. Suessmeyer.
---
http://www.sqlserver2005.de
---
averge joe
If you know that your @starttime and @endtime variables NEVER include seconds or milliseconds you can check like this:
If your @starttime and @endtime variables might include seconds or milliseconds you can do your comparisons like this: