Any help would be great!!(I'm a newbie)
hope that helps..
"Edward Carrigan III" <edw...@enthusiasm.com> wrote in message
news:3ad37...@news.nwlink.com...
declare @startdate datetime,
@enddate datetime
set @startdate = getdate()
set @enddate = getdate()-7
select @startdate
select @enddate
select convert(float,datediff(hour,@enddate,@startdate))
it returns 168 without the convert, but with convert returns 168.0
That help??
"Matt Pavey" <mpa...@ind.tds.net> wrote in message
news:#4y4yDgwAHA.1432@tkmsftngp02...
Are you sure you would like a value of the datatype float, it is approximate
and will not
allways return the value you expect. It seems you would be better of with
decimal if
you will be needing decimals in your value.
/Tobias
SQL Server MCT
* Please post replies to the newsgroup *
"Edward Carrigan III" <edw...@enthusiasm.com> wrote in message
news:3ad37...@news.nwlink.com...
SET @totalHours = 1.0 * DATEDIFF(minute, @startTime, @lunchOut) / 60 +
1.0 * DATEDIFF(minute, @lunchIn, @endTime) / 60
Or
SET @totalHours = 1.0 * ( DATEDIFF(minute, @startTime, @lunchOut) +
DATEDIFF(minute, @lunchIn, endTime) ) / 60
you will be able to get fractions of an hour.
[]s
Fabio Ide
"Edward Carrigan III" <edw...@enthusiasm.com> escreveu na mensagem
news:3ad37...@news.nwlink.com...
Works beautifully!!!
Ed
"Fabio Luiz Ide" <fabi...@directtalk.com.br> wrote in message
news:ON$WYOgwAHA.1844@tkmsftngp05...