Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select as time value

Author  Topic 

anupalavila
Yak Posting Veteran

56 Posts

Posted - 2013-12-17 : 08:40:12
I have a table attendance with fields empId,normalhrs,normalmins which are integer types.I am storing the working hrs and mins seprately, How can I make a selection such that I could select by adding normalhrs and normalmins.
eg: if in field normalhrs -->8 and in normalmins --> 30 I could select as 8.30

Thanks and Regards
Anu Palavila

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-12-17 : 08:46:24
[code]select normalhrs + normalmins / 100.0[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-12-17 : 08:51:35
with testdata you can see what is possible:

declare @sample table (normalhours int, normalmins int)
insert @sample
select 8,30 union all
select 11,45

select str(normalhours,len(normalhours))+'.'+str(normalmins,len(normalmins)) from @sample

select convert(varchar(10),normalhours)+'.'+convert(varchar(10),normalmins) from @sample

select normalhours + normalmins / 100.0 from @sample


Too old to Rock'n'Roll too young to die.
Go to Top of Page
   

- Advertisement -