473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

time conversion hiccup

Hi,

ddl & dml
project varchar(10) start char(5) stop char(5)
------------------------- ----- -----
hey now 21:00 19:25
new test 20:25 20:30
t 10 21:00 NULL
t 11 21:10 21:35
t 12 21:30 22:40
t 12 7:05 11:10
test me 08:00 14:25
test me 17:00 17:55

what I want is to calculate time duration using hour (h.1decimal) e.g.
1.2 :
what I have now using the following query:
select project, start, stop,
CASE WHEN (datediff(n,start,stop) < 0) THEN -1
WHEN (datediff(n,start,stop) < 1) THEN (CAST(datediff(n,start,stop)
as decimal(1)))
ELSE Convert(decimal(1),(datediff(n,start,stop)/60)) END as
total_hours
from testTBl
group by project, start, stop

output:
project start stop total_hours
------------------------- ----- ----- -----------
hey now 21:00 19:25 -1
new test 20:25 20:30 0
t 10 21:00 NULL NULL
t 11 21:10 21:35 0
t 12 21:30 22:40 1
t 12 7:05 11:10 4
test me 08:00 14:25 6
test me 17:00 17:55 0

If the calcuate is right I'd like to remove start and stop columns,
so, it would just return project and the sum of hours including less
than an hour in decimal for each.

Thank you.

Sep 18 '07 #1
19 2263
Hi !

What I can see via quick read are two errors or mistakes.

1) Definition of a variable or result of type decimal(1), can store at the
most one total number of digits both to the left and to the right of the
decimal point, so you'll never get a result with anything more than a single
digit number, even if the result should be 10 or more, in which case you
should get an overflow error.

2) The division by the integer number 60 forces the operation to be an
integer division, as you can easily see by executing this statement:
select datediff(n,'08:00','14:25')/60,

convert(decimal(1),datediff(n,'08:00','14:25')/60),

datediff(n,'08:00','14:25')/60.0,

convert(decimal(1),datediff(n,'08:00','14:25')/60.0)

Hope this helps,

Palli

<Do*******@gmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,

ddl & dml
project varchar(10) start char(5) stop char(5)
------------------------- ----- -----
hey now 21:00 19:25
new test 20:25 20:30
t 10 21:00 NULL
t 11 21:10 21:35
t 12 21:30 22:40
t 12 7:05 11:10
test me 08:00 14:25
test me 17:00 17:55

what I want is to calculate time duration using hour (h.1decimal) e.g.
1.2 :
what I have now using the following query:
select project, start, stop,
CASE WHEN (datediff(n,start,stop) < 0) THEN -1
WHEN (datediff(n,start,stop) < 1) THEN (CAST(datediff(n,start,stop)
as decimal(1)))
ELSE Convert(decimal(1),(datediff(n,start,stop)/60)) END as
total_hours
from testTBl
group by project, start, stop

output:
project start stop total_hours
------------------------- ----- ----- -----------
hey now 21:00 19:25 -1
new test 20:25 20:30 0
t 10 21:00 NULL NULL
t 11 21:10 21:35 0
t 12 21:30 22:40 1
t 12 7:05 11:10 4
test me 08:00 14:25 6
test me 17:00 17:55 0

If the calcuate is right I'd like to remove start and stop columns,
so, it would just return project and the sum of hours including less
than an hour in decimal for each.

Thank you.

Sep 18 '07 #2
Beautiful, thank you.

On Sep 18, 9:43 am, "Pall Bjornsson" <pa...@kvos.iswrote:
Hi !

What I can see via quick read are two errors or mistakes.

1) Definition of a variable or result of type decimal(1), can store at the
most one total number of digits both to the left and to the right of the
decimal point, so you'll never get a result with anything more than a single
digit number, even if the result should be 10 or more, in which case you
should get an overflow error.

2) The division by the integer number 60 forces the operation to be an
integer division, as you can easily see by executing this statement:
select datediff(n,'08:00','14:25')/60,

convert(decimal(1),datediff(n,'08:00','14:25')/60),

datediff(n,'08:00','14:25')/60.0,

convert(decimal(1),datediff(n,'08:00','14:25')/60.0)

Hope this helps,

Palli

<DonLi2...@gmail.comwrote in message

news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,
OP omitted
- Show quoted text -

Sep 18 '07 #3
ahe, I spoke a bit too soon, new prob.
data sets:
start stop
19:30 02:15 (next day morning)
26:15 (invalid hh:mm time range)

CASE WHEN (datediff(n,start,stop) < 0) THEN 0 END

above stmt not good, what now? got to go eat, could you help me to
think, oh, you may ask, may I eat for you as well? :) thanks a
billion...

On Sep 18, 10:58 am, DonLi2...@gmail.com wrote:
Beautiful, thank you.

On Sep 18, 9:43 am, "Pall Bjornsson" <pa...@kvos.iswrote:
Hi !
What I can see via quick read are two errors or mistakes.
1) Definition of a variable or result of type decimal(1), can store at the
most one total number of digits both to the left and to the right of the
decimal point, so you'll never get a result with anything more than a single
digit number, even if the result should be 10 or more, in which case you
should get an overflow error.
2) The division by the integer number 60 forces the operation to be an
integer division, as you can easily see by executing this statement:
select datediff(n,'08:00','14:25')/60,
convert(decimal(1),datediff(n,'08:00','14:25')/60),
datediff(n,'08:00','14:25')/60.0,
convert(decimal(1),datediff(n,'08:00','14:25')/60.0)
Hope this helps,
Palli
<DonLi2...@gmail.comwrote in message
news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,
OP omitted
- Show quoted text -- Hide quoted text -

- Show quoted text -

Sep 19 '07 #4
Do*******@gmail.com wrote:
ahe, I spoke a bit too soon, new prob.
data sets:
start stop
19:30 02:15 (next day morning)
26:15 (invalid hh:mm time range)

CASE WHEN (datediff(n,start,stop) < 0) THEN 0 END
Assuming that the stop time is always within 24 hours after the
start time:

case
when datediff(n,start,stop) < 0
then datediff(n,start,stop) + 1440 -- minutes per day
else datediff(n,start,stop)
end
Sep 19 '07 #5
Yeah, I solved it in a similar fasion this morning, sorry for the late
update.

On Sep 19, 9:32 am, Ed Murphy <emurph...@socal.rr.comwrote:
DonLi2...@gmail.com wrote:
ahe, I spoke a bit too soon, new prob.
data sets:
start stop
19:30 02:15 (next day morning)
26:15 (invalid hh:mm time range)
CASE WHEN (datediff(n,start,stop) < 0) THEN 0 END

Assuming that the stop time is always within 24 hours after the
start time:

case
when datediff(n,start,stop) < 0
then datediff(n,start,stop) + 1440 -- minutes per day
else datediff(n,start,stop)
end

Sep 19 '07 #6
On Sep 18, 9:43 am, "Pall Bjornsson" <pa...@kvos.iswrote:
Hi !

What I can see via quick read are two errors or mistakes.

1) Definition of a variable or result of type decimal(1), can store at the
most one total number of digits both to the left and to the right of the
decimal point, so you'll never get a result with anything more than a single
digit number, even if the result should be 10 or more, in which case you
should get an overflow error.

2) The division by the integer number 60 forces the operation to be an
integer division, as you can easily see by executing this statement:
select datediff(n,'08:00','14:25')/60,

convert(decimal(1),datediff(n,'08:00','14:25')/60),

datediff(n,'08:00','14:25')/60.0,

convert(decimal(1),datediff(n,'08:00','14:25')/60.0)

Hope this helps,

Palli

<DonLi2...@gmail.comwrote in message

news:11**********************@g4g2000hsf.googlegro ups.com...
Hi,
ddl & dml
project varchar(10) start char(5) stop char(5)
------------------------- ----- -----
hey now 21:00 19:25
new test 20:25 20:30
t 10 21:00 NULL
t 11 21:10 21:35
t 12 21:30 22:40
t 12 7:05 11:10
test me 08:00 14:25
test me 17:00 17:55
what I want is to calculate time duration using hour (h.1decimal) e.g.
1.2 :
what I have now using the following query:
select project, start, stop,
CASE WHEN (datediff(n,start,stop) < 0) THEN -1
WHEN (datediff(n,start,stop) < 1) THEN (CAST(datediff(n,start,stop)
as decimal(1)))
ELSE Convert(decimal(1),(datediff(n,start,stop)/60)) END as
total_hours
from testTBl
group by project, start, stop
output:
project start stop total_hours
------------------------- ----- ----- -----------
hey now 21:00 19:25 -1
new test 20:25 20:30 0
t 10 21:00 NULL NULL
t 11 21:10 21:35 0
t 12 21:30 22:40 1
t 12 7:05 11:10 4
test me 08:00 14:25 6
test me 17:00 17:55 0
If the calcuate is right I'd like to remove start and stop columns,
so, it would just return project and the sum of hours including less
than an hour in decimal for each.
Thank you.- Hide quoted text -

- Show quoted text -
Hi, there's a bug. The following query would return what is expected,
good.
select pkCol, cddate as origdate,convert(char,cddate,101) as
ddate, start, stop, project,
CASE WHEN (datediff(n,start,stop) < 0) THEN
Left((datediff(n,start,'23:59') + datepart(n,'2007-09-19
10:01:00') + datediff(n,'00:00',stop))/60.0,4)
ELSE Left(datediff(n,start,stop)/60.0,4) END as
hours_spent
from testTBL

However, when switching to sum function for the above like, I'm
getting invalid results, the culprit seems to be the entry/entries
with two dates overlap, see a sample below the following query? And
the odd thing is, when I tested the query against this particular
entry, it generated correct resultset (summary), but not a query like
the one below, how come and more importantly how to fix it? Thanks.
select project,
CASE WHEN (SUM(datediff(n,start,stop)/60.0) < 0)
THEN Left(SUM((datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop))/60.0),
4)
WHEN (SUM(datediff(n,start,stop)/60.0) 0)
THEN Left(SUM(datediff(n,start,stop)/60.0),4) End as
total_hours
from testTBL
group by project
cddate project start stop
----------- ------------ ----- ----- ----------- ------
10/2/2007 hey now 23:05 1:15
Oct 3 '07 #7
(ta********@gmail.com) writes:
Hi, there's a bug. The following query would return what is expected,
good.
select pkCol, cddate as origdate,convert(char,cddate,101) as
ddate, start, stop, project,
CASE WHEN (datediff(n,start,stop) < 0) THEN
Left((datediff(n,start,'23:59') + datepart(n,'2007-09-19
10:01:00') + datediff(n,'00:00',stop))/60.0,4)
ELSE Left(datediff(n,start,stop)/60.0,4) END as
hours_spent
from testTBL

However, when switching to sum function for the above like, I'm
getting invalid results, the culprit seems to be the entry/entries
with two dates overlap, see a sample below the following query? And
the odd thing is, when I tested the query against this particular
entry, it generated correct resultset (summary), but not a query like
the one below, how come and more importantly how to fix it? Thanks.
select project,
CASE WHEN (SUM(datediff(n,start,stop)/60.0) < 0)
THEN Left(SUM((datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop))/60.0),
4)
WHEN (SUM(datediff(n,start,stop)/60.0) 0)
THEN Left(SUM(datediff(n,start,stop)/60.0),4) End as
total_hours
from testTBL
group by project
It could help if you posted the CREATE TABLE statement for the table,
INSERT statments with sample data, and the desired result. I can't
exactly see what you are looking for. But one think looks funny to
me: you have SUM on every expression in the CASE. I would expect the
SUM to be around the entire CASE. But as I said, I don't know what
this query is supposed to achieve.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 3 '07 #8
On Oct 3, 5:00 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
(tatata9...@gmail.com) writes:
Hi, there's a bug. The following query would return what is expected,
good.
select pkCol, cddate as origdate,convert(char,cddate,101) as
ddate, start, stop, project,
CASE WHEN (datediff(n,start,stop) < 0) THEN
Left((datediff(n,start,'23:59') + datepart(n,'2007-09-19
10:01:00') + datediff(n,'00:00',stop))/60.0,4)
ELSE Left(datediff(n,start,stop)/60.0,4) END as
hours_spent
from testTBL
However, when switching to sum function for the above like, I'm
getting invalid results, the culprit seems to be the entry/entries
with two dates overlap, see a sample below the following query? And
the odd thing is, when I tested the query against this particular
entry, it generated correct resultset (summary), but not a query like
the one below, how come and more importantly how to fix it? Thanks.
select project,
CASE WHEN (SUM(datediff(n,start,stop)/60.0) < 0)
THEN Left(SUM((datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop))/60.0),
4)
WHEN (SUM(datediff(n,start,stop)/60.0) 0)
THEN Left(SUM(datediff(n,start,stop)/60.0),4) End as
total_hours
from testTBL
group by project

It could help if you posted the CREATE TABLE statement for the table,
INSERT statments with sample data, and the desired result. I can't
exactly see what you are looking for. But one think looks funny to
me: you have SUM on every expression in the CASE. I would expect the
SUM to be around the entire CASE. But as I said, I don't know what
this query is supposed to achieve.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide quoted text -

- Show quoted text -
Erland,

You're the Man! Thank you.
Oct 4 '07 #9
On Oct 3, 5:00 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
(tatata9...@gmail.com) writes:
Hi, there's a bug. The following query would return what is expected,
good.
select pkCol, cddate as origdate,convert(char,cddate,101) as
ddate, start, stop, project,
CASE WHEN (datediff(n,start,stop) < 0) THEN
Left((datediff(n,start,'23:59') + datepart(n,'2007-09-19
10:01:00') + datediff(n,'00:00',stop))/60.0,4)
ELSE Left(datediff(n,start,stop)/60.0,4) END as
hours_spent
from testTBL
However, when switching to sum function for the above like, I'm
getting invalid results, the culprit seems to be the entry/entries
with two dates overlap, see a sample below the following query? And
the odd thing is, when I tested the query against this particular
entry, it generated correct resultset (summary), but not a query like
the one below, how come and more importantly how to fix it? Thanks.
select project,
CASE WHEN (SUM(datediff(n,start,stop)/60.0) < 0)
THEN Left(SUM((datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop))/60.0),
4)
WHEN (SUM(datediff(n,start,stop)/60.0) 0)
THEN Left(SUM(datediff(n,start,stop)/60.0),4) End as
total_hours
from testTBL
group by project

It could help if you posted the CREATE TABLE statement for the table,
INSERT statments with sample data, and the desired result. I can't
exactly see what you are looking for. But one think looks funny to
me: you have SUM on every expression in the CASE. I would expect the
SUM to be around the entire CASE. But as I said, I don't know what
this query is supposed to achieve.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide quoted text -

- Show quoted text -
oops, I hit the response button too fast. Now,
option a:
SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60) End) as
total_hours
returned summary/calculated about right, but it's at hour level, so,
0.45 minutes would be discarded, not very good

option b:
SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60.0) End) as
total_hours
returned bloated up data (too much), not good at all

What else? As always, many thanks.

Oct 4 '07 #10
ta********@gmail.com wrote:
SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60) End) as
total_hours
returned summary/calculated about right, but it's at hour level, so,
0.45 minutes would be discarded, not very good
CASTing datediff() to some appropriate DECIMAL type should take
care of it.
Oct 4 '07 #11
On Oct 3, 9:30 pm, Ed Murphy <emurph...@socal.rr.comwrote:
tatata9...@gmail.com wrote:
SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60) End) as
total_hours
returned summary/calculated about right, but it's at hour level, so,
0.45 minutes would be discarded, not very good

CASTing datediff() to some appropriate DECIMAL type should take
care of it.
I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.

Oct 4 '07 #12
ta********@gmail.com wrote:
On Oct 3, 9:30 pm, Ed Murphy <emurph...@socal.rr.comwrote:
>tatata9...@gmail.com wrote:
>> SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60) End) as
total_hours
returned summary/calculated about right, but it's at hour level, so,
0.45 minutes would be discarded, not very good
CASTing datediff() to some appropriate DECIMAL type should take
care of it.

I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.
Try DECIMAL(10,2) and see how that works for you.
Oct 5 '07 #13
On Oct 4, 7:59 pm, Ed Murphy <emurph...@socal.rr.comwrote:
tatata9...@gmail.com wrote:
On Oct 3, 9:30 pm, Ed Murphy <emurph...@socal.rr.comwrote:
tatata9...@gmail.com wrote:
SUM(CASE WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60) End) as
total_hours
returned summary/calculated about right, but it's at hour level, so,
0.45 minutes would be discarded, not very good
CASTing datediff() to some appropriate DECIMAL type should take
care of it.
I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.

Try DECIMAL(10,2) and see how that works for you.
Thank you, this is a good idea to try. Here's some sample result,
before I do that, let me refresh ddl a bit for clarity,
both start and stop columns are of char(5) nullable.
The query looks like this
select SUM(Convert(DECIMAL(10,2), CASE WHEN (datediff(n,start,stop)/60
< 0)
THEN (datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop)/60.0)
WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60.0) ...
Also, I tried the DECIMAL(10,2) and its variants for a regular query,
then use app language to total it.
The difference is, the sum one is 94.80 hours while the regular query
is 90.24. Not satisfactory.

I've also looked up BOL for it, and tried different p/s variants to no
avail. Hmm, am I stuck?



Oct 5 '07 #14
(ta********@gmail.com) writes:
I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.
Decimal(1) means a number in the range 0-9 with no decimals.

I usually sort this out by simply multiplying with 1.0. Like in many other
languages, / in T-SQL is integer division when two integers meet.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 5 '07 #15
On Oct 4, 10:31 pm, tatata9...@gmail.com wrote:
On Oct 4, 7:59 pm, Ed Murphy <emurph...@socal.rr.comwrote:
tatata9...@gmail.com wrote:
On Oct 3, 9:30 pm, Ed Murphy <emurph...@socal.rr.comwrote:
>tatata9...@gmail.com wrote:
>> SUM(CASE WHEN (datediff(n,start,stop)/60 0)
>> THEN (datediff(n,start,stop)/60) End) as
>>total_hours
>> returned summary/calculated about right, but it's at hour level, so,
>>0.45 minutes would be discarded, not very good
>CASTing datediff() to some appropriate DECIMAL type should take
>care of it.
I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.
Try DECIMAL(10,2) and see how that works for you.

Thank you, this is a good idea to try. Here's some sample result,
before I do that, let me refresh ddl a bit for clarity,
both start and stop columns are of char(5) nullable.
The query looks like this
select SUM(Convert(DECIMAL(10,2), CASE WHEN (datediff(n,start,stop)/60
< 0)
THEN (datediff(n,start,'23:59') +
datepart(n,'2007-09-19 10:01:00') + datediff(n,'00:00',stop)/60.0)
WHEN (datediff(n,start,stop)/60 0)
THEN (datediff(n,start,stop)/60.0) ...
Also, I tried the DECIMAL(10,2) and its variants for a regular query,
then use app language to total it.
The difference is, the sum one is 94.80 hours while the regular query
is 90.24. Not satisfactory.

I've also looked up BOL for it, and tried different p/s variants to no
avail. Hmm, am I stuck?
Update: odd. When I tried another set of data, for a total of 100
hours, using your technique, the difference between sum query and
regular query is now less than an hour, not too bad. But what if we
run into 1000 hours?
Oct 7 '07 #16
On Oct 5, 2:16 am, Erland Sommarskog <esq...@sommarskog.sewrote:
(tatata9...@gmail.com) writes:
I've tried DECIMAL(1) and (2) respectively to no avail. Do you have a
sample one? Thanks.

Decimal(1) means a number in the range 0-9 with no decimals.

I usually sort this out by simply multiplying with 1.0. Like in many other
languages, / in T-SQL is integer division when two integers meet.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Interesting idea, Erland, but it did not seem to work for me, maybe I
didn't do it right? Only two variations.
Oct 7 '07 #17
(ta********@gmail.com) writes:
Interesting idea, Erland, but it did not seem to work for me, maybe I
didn't do it right? Only two variations.
We have only seen fragments and pieces of what you have been doing. It
would help if you posted a create table statement for your table, insert
statements with sample data, and the desired result given the sample.
That makes it easy to develop tested query. Without that, we are mainly
guessing.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 7 '07 #18
On Oct 7, 9:36 am, Erland Sommarskog <esq...@sommarskog.sewrote:
(tatata9...@gmail.com) writes:
Interesting idea, Erland, but it did not seem to work for me, maybe I
didn't do it right? Only two variations.

We have only seen fragments and pieces of what you have been doing. It
would help if you posted a create table statement for your table, insert
statements with sample data, and the desired result given the sample.
That makes it easy to develop tested query. Without that, we are mainly
guessing.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Good News! Problem resolved. Culprit, 'WHEN (datediff(n,start,stop)/
60 0)' needs to be
WHEN (datediff(n,start,stop)/60.0 0)

Many thanks.

Oct 8 '07 #19
(ta********@gmail.com) writes:
Good News! Problem resolved. Culprit, 'WHEN (datediff(n,start,stop)/
60 0)' needs to be
WHEN (datediff(n,start,stop)/60.0 0)
Great to hear! Thanks for posting back and telling us. I'm taking the
liberty to not look at your scripts then.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 8 '07 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: heirou | last post by:
I'm a novice in this subject....I've made a database that requires a time conversion. For example, if local time is 1200, determine the time in Korea. I use two fields: a date field, and a time...
6
by: DCSudolcan | last post by:
I know that a program can create and properly initialize an array of pointers to functions at build time, but can something like the following be done at build time? void foo(void); unsigned...
5
by: Paulers | last post by:
Hello, I'm working on an app that requires the functionality to convert the time in Austrailia to the time in New York (EST). I am wondering, what is the bestway to approach this in vb.net? Is...
3
by: Jason S | last post by:
is there any way to use templates to bind integer/floating point constants to a template for compile-time use? e.g. template <double conversion> class meters { const factor = conversion;
4
by: melton9 | last post by:
I have a form that updates once a second. When it updates there is no other processing going on. It generally works fine, but a few times a min sometimes less, sometimes more it will hiccup and...
3
by: moni | last post by:
Hi, I wanted to convert a time value in the form of time_t into a readable form in C# or vice versa, in order to be able to subtract two time values and give the result in msecs. eg. I...
3
by: Evan Klitzke | last post by:
Although it is not present in ANSI C, the GNU version of stftime supports the conversion character %z, which is a time offset from GMT. The four digit time offset is required in RFC 2822...
5
by: fimarn | last post by:
I am trying to get rid of compile time error that I am getting only in RHEL5 (not in RHEL4) apparently due to the changes in the stl_list.h file. The error that I am getting is coming from the...
5
by: Grey Alien | last post by:
I need to convert timestamps that are given as the number of seconds that have elapsed since midnight UTC of January 1, 1970, (not counting leap seconds). It seems all of the std C functions...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.