Doubt related with stored procedure

Posted by Amritha444 under Sql Server on 8/28/2010 | Points: 10 | Views : 1140 | Status : [Member] | Replies : 3
i want to compare value of the format 08:00:00 in my stored procedure. This to catch latecomers i want to compare each and every Intime field of employees in the database with max delay time.how to compare such formats.database entries are in the format 08:00:00.Can anyone suggest good idea to solve this
Tannks in Advance




Responses

Posted by: PandianS on: 8/28/2010 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

If your employees' In-time is...

08:00:00
08:10:00
07:05:00
07:05:39


If So, You can convert the column into as given below

SELECT CAST(CONVERT(VARCHAR,GETDATE(),112) + ' ' + InTime AS DATETIME) FROM Employee

So, It gives the formatted DateTime value as given below for your actual data


2010-08-28 08:00:00.000
2010-08-28 08:10:00.000
2010-08-28 07:05:00.000
2010-08-28 07:05:39.000


Now, you can easily compare with Datetime Intrinsic SQL Server functions...

Cheers


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amritha444 on: 8/31/2010 [Member] Starter | Points: 25

Up
0
Down
i got output by using this
IF(att_M_Intime>=TIME('08:45:00')) THEN

Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amritha444 on: 8/31/2010 [Member] Starter | Points: 25

Up
0
Down
Thank you


Amritha444, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response