Tipos de Datos

10/02/2004 - 23:38 por Serafin Salazar | Informe spam
HolaBuenas Tardes...
Tengo esta funcion:

create function fGetAlertIncrement(
@Value smallint,
@ws_time_type char(10))
returns real
AS
begin
declare @IncrementValue real
select @IncrementValue case @ws_time_type
when 'hour' then @Value/24
when 'week' then @Value*7
else 0
end
return @IncrementValue
end
/*
Cuando la llamo con estos parametros

select dbo.fGetAlertIncrement(4,'hour')


me retorna cero!!!, cuando deberia retornar 0.16666

Please Help Me!!

Preguntas similare

Leer las respuestas

#1 Norman A. Armas
10/02/2004 - 23:07 | Informe spam
declara @Value como real o hazle un Convert en el momento de la operacion
matematica.

Saludos,

Norman



"Serafin Salazar" wrote in message
news:%
HolaBuenas Tardes...
Tengo esta funcion:

create function fGetAlertIncrement(
@Value smallint,
@ws_time_type char(10))
returns real
AS
begin
declare @IncrementValue real
select @IncrementValue> case @ws_time_type
when 'hour' then @Value/24
when 'week' then @Value*7
else 0
end
return @IncrementValue
end
/*
Cuando la llamo con estos parametros

select dbo.fGetAlertIncrement(4,'hour')


me retorna cero!!!, cuando deberia retornar 0.16666

Please Help Me!!



Respuesta Responder a este mensaje
#2 ulises
10/02/2004 - 23:54 | Informe spam
Otra opción más sencilla es hacer la división entre "24.0"
de la siguiente forma :

when 'hour' then @Value/24.0

de esa forma ya no se trata de una división de un entero
contra un entero.

Saludos,
Ulises

declara @Value como real o hazle un Convert en el momento


de la operacion
matematica.

Saludos,



Norman



"Serafin Salazar" wrote in message
news:%
HolaBuenas Tardes...
Tengo esta funcion:

create function fGetAlertIncrement(
@Value smallint,
@ws_time_type char(10))
returns real
AS
begin
declare @IncrementValue real
select @IncrementValue>> case @ws_time_type
when 'hour' then @Value/24
when 'week' then @Value*7
else 0
end
return @IncrementValue
end
/*
Cuando la llamo con estos parametros

select dbo.fGetAlertIncrement(4,'hour')


me retorna cero!!!, cuando deberia retornar 0.16666

Please Help Me!!







.

Respuesta Responder a este mensaje
#3 Serafin Salazar
11/02/2004 - 00:11 | Informe spam
That's it!!! Thanks..!
"Norman A. Armas" escribió en el mensaje
news:
declara @Value como real o hazle un Convert en el momento de la operacion
matematica.

> Saludos,

Norman



"Serafin Salazar" wrote in message
news:%
> HolaBuenas Tardes...
> Tengo esta funcion:
>
> create function fGetAlertIncrement(
> @Value smallint,
> @ws_time_type char(10))
> returns real
> AS
> begin
> declare @IncrementValue real
> select @IncrementValue> > case @ws_time_type
> when 'hour' then @Value/24
> when 'week' then @Value*7
> else 0
> end
> return @IncrementValue
> end
> /*
> Cuando la llamo con estos parametros
>
> select dbo.fGetAlertIncrement(4,'hour')
>
>
> me retorna cero!!!, cuando deberia retornar 0.16666
>
> Please Help Me!!
>
>
>


email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida