SQL Function not returning same value over ADP

K

Keith

Here's my function in MS SQL 2000:

ALTER FUNCTION dbo.fncDecimalHoursToHrsMins
(
@dInput DECIMAL(38,10)
)
RETURNS VARCHAR(10) AS
BEGIN

DECLARE @iMins INT

SET @iMins = ROUND((@dInput - CAST(FLOOR(@dInput) AS
DECIMAL(38,10))) * 60.00000, 0)

RETURN
(
LTRIM(RTRIM(STR(FLOOR(@dInput)))) + ':' + CASE WHEN @iMins < 10
THEN '0' ELSE '' END + LTRIM(RTRIM(STR(@iMins)))
)

END

-- end of fncDecimalHoursToHrsMins

It's been in use for a few years from an MDB and has always run fine.
For example if you enter 5.3333333 it returns 5:20 as expected. It
also runs fine from Query Analyzer. We've converted the MDB system to
an ADP system and this function does not run correctly from the ADP.
It turns the minutes into "00". So for example if you double click the
function in the ADP query window and enter 5.333333 it returns 5:00.

Any ideas?

Thanks,

Keith
 
S

Sylvain Lafontaine

You don't say how you are calling this function from ADP but the most likely
explanation would be that the parameter @dInput is incorrectly passed from
ADP to the function. This should be easy to check.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top