Not in MSSQL 2000 or earlier. Create your own:

CREATE FUNCTION MAX_INT (

        @int1 INT,
        @int2 INT

) RETURNS INT

AS

BEGIN

        DECLARE @highestInt INT

        IF ( @int2 < @int1 )
                SELECT @highestInt = @int1
        ELSE
                SELECT @highestInt = @int2

        RETURN @highestInt

END

GO

Adrian

-----Original Message-----
From: James Smith [mailto:[EMAIL PROTECTED]
Sent: 05 December 2006 10:26
To: CF-Talk
Subject: MSSQL Function (Div 0)?


I have a query that will ocasionally throw a divide by 0 error.  I know why,
and for my purposes it will do to make the 0 a 0.01

In the following SQL...

SELECT col1/col2 AS result
FROM aTable

What is the simplest way to make col2 "0.01" if it is 0.

Is there an equivelent of the CF max() function, max(col2,0.01) would work
for example, or an equivalent of the isNull() function for is0() ;-)

--
Jay




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262842
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to