> Both excellent solutions thanks guys, in the end I went with...
>
> isNull(m.ListPrice,0) + 0.01
Most people don't care, but I always have to point out that isNull is a
proprietary Microsoft function, while Coalesce() is ANSI standard and
has the same basic syntax.
"EMF " made the followin
I have a place for the extra penny. Let me give you my bank routing
number
~Brad
-Original Message-
From: James Smith [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 05, 2006 10:05 AM
To: CF-Talk
Subject: RE: MSSQL Function (Div 0)?
Both excellent solutions thanks guys, in the
Both excellent solutions thanks guys, in the end I went with...
isNull(m.ListPrice,0) + 0.01
This will produce slightly inacurate results but since this is a percentage
calculation that gets truncated to an INT anyway the minor inacuracy caused
by the extra penny doesn't matter in this case. I w
James Smith wrote:
>
> SELECT col1/col2 AS result
> FROM aTable
>
> What is the simplest way to make col2 "0.01" if it is 0.
>
You also could do it with a CASE statement...
SELECT col1/CASE col2 WHEN 0 THEN 0.01 ELSE col2 END AS result
OR
SELECT CASE col2 WHEN 0 THEN -1 ELSE col1/col2 END AS
Int = @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 w
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() functio
> Take a look at SUBSTRING.
> Ade
> -Original Message-
> From: Protoculture [mailto:[EMAIL PROTECTED]
> Sent: 10 May 2005 15:32
> To: CF-Talk
> Subject: MSSQL Function
> I have a variable like this.. ',6,6,8,2,10,11,'
> what mssql function(s) ca
Take a look at SUBSTRING.
Ade
-Original Message-
From: Protoculture [mailto:[EMAIL PROTECTED]
Sent: 10 May 2005 15:32
To: CF-Talk
Subject: MSSQL Function
I have a variable like this.. ',6,6,8,2,10,11,'
what mssql function(s) can I use to remove the commas before the first 6
I have a variable like this.. ',6,6,8,2,10,11,'
what mssql function(s) can I use to remove the commas before the first 6 and
after the last number (11) ?
~|
Logware (www.logware.us): a new and convenient web-based tim
9 matches
Mail list logo