Re: it maybe a wrong return value
- From: "Hari Prasad" <hari_prasad_k@xxxxxxxxxxx>
- Date: Tue, 6 Feb 2007 07:15:01 -0600
Please give the precision and scale while using decimal. See the below
example.
ALTER Function dbo.abc
(@ParamOne numeric(10,2), @ParamTwo numeric(10,2))
RETURNS Bit
AS
BEGIN
DECLARE @Result bit
if abs(@ParamOne-@ParamTwo)<0.01
SET @Result=1
else
SET @Result=0
RETURN @Result
END
Thanks
Hari
"Lorry Astra" <LorryAstra@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A86A320C-192C-4321-A4D4-05B32ADC3BD1@xxxxxxxxxxxxxxxx
There is a sql function like this below:
Create Function dbo.abc
(@ParamOne decimal, @ParamTwo decimal)
RETURNS Bit
AS
BEGIN
DECLARE @Result bit
if abs(@ParamOne-@ParamTwo)<0.01
SET @Result=1
else
SET @Result=0
RETURN @Result
END
if i execute this sentence: "select dbo.abc (2.12,2.11)" , why does the
function return 1 instead of 0?
Thanks.
Lorry
.
- Prev by Date: Re: *= Notation in 2005
- Next by Date: attn: pearline - really emotional postings - ujgu - (1/1)
- Previous by thread: Re: *= Notation in 2005
- Next by thread: attn: pearline - really emotional postings - ujgu - (1/1)
- Index(es):
Relevant Pages
|
|