UDF finding Value between 0 and 1  
Author Message
Damiano





PostPosted: Fri Jun 24 14:52:03 CDT 2005 Top

SQL Server Developer >> UDF finding Value between 0 and 1

I have a simple User defined function and I want to find values that are
equal to 0, Equal to 1, Between 0 and 1, and Null. The data I am using is an
Avg on a numeric value. When looking at the average the values appear
correct. Like 0, 1, 0.5 etc..., The values apparently are being rounded
currently. i.e. 0.5 returns 'POS' rather than 'SEG'. Any Ideas on how to
correct the function ? Apparently I am not seeing the light.



RETURNS varchar(5)

AS

BEGIN





















END

SQL Server265  
 
 
AlejandroMesa





PostPosted: Fri Jun 24 14:52:03 CDT 2005 Top

SQL Server Developer >> UDF finding Value between 0 and 1 Dan,



Put precision and scale in the declaration of the parameter.


AMB




> I have a simple User defined function and I want to find values that are
> equal to 0, Equal to 1, Between 0 and 1, and Null. The data I am using is an
> Avg on a numeric value. When looking at the average the values appear
> correct. Like 0, 1, 0.5 etc..., The values apparently are being rounded
> currently. i.e. 0.5 returns 'POS' rather than 'SEG'. Any Ideas on how to
> correct the function ? Apparently I am not seeing the light.
>

>
> RETURNS varchar(5)
>
> AS
>
> BEGIN
>

>

>

>

>

>

>

>

>

>

>
> END
 
 
DanH





PostPosted: Fri Jun 24 15:34:04 CDT 2005 Top

SQL Server Developer >> UDF finding Value between 0 and 1 Thanks.



> Dan,
>

>
> Put precision and scale in the declaration of the parameter.
>
>
> AMB
>
>

>
> > I have a simple User defined function and I want to find values that are
> > equal to 0, Equal to 1, Between 0 and 1, and Null. The data I am using is an
> > Avg on a numeric value. When looking at the average the values appear
> > correct. Like 0, 1, 0.5 etc..., The values apparently are being rounded
> > currently. i.e. 0.5 returns 'POS' rather than 'SEG'. Any Ideas on how to
> > correct the function ? Apparently I am not seeing the light.
> >

> >
> > RETURNS varchar(5)
> >
> > AS
> >
> > BEGIN
> >

> >

> >

> >

> >

> >

> >

> >

> >

> >

> >
> > END