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.
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.30Thanks 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] |
|
|
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 @sampleselect 8,30 union allselect 11,45select str(normalhours,len(normalhours))+'.'+str(normalmins,len(normalmins)) from @sampleselect convert(varchar(10),normalhours)+'.'+convert(varchar(10),normalmins) from @sampleselect normalhours + normalmins / 100.0 from @sample Too old to Rock'n'Roll too young to die. |
|
|
|
|
|