Crear Funciones

04/02/2005 - 17:38 por andrey2001 | Informe spam
Hola Grupo...

Estoy tratando de crear funciones definidas por el usuario y al crear
esta...

CREATE FUNCTION bd.dbo.fnsaldo (@cedula varchar(11))
RETURNS money AS
BEGIN
select sum(cursaldo) from tbldoc where strtipdoc='FC' and strcodca=@cedula
END

me da estos errores

"error 170. line 1.incorrect syntax near "function".
must declare the variable '@cedual'

Que pasara...?

Gracias de antemano...
 

Leer las respuestas

#1 Tinoco
04/02/2005 - 17:53 | Informe spam
Hola Andrey,

No se porque este error, pero a la funcion le falta el RETURN().

CREATE FUNCTION dbo.fnsaldo (@cedula varchar(11))
RETURNS money AS
BEGIN
RETURN(select sum(cursaldo) from tbldoc where strtipdoc='FC' and
strcodca=@cedula)
END

Hermilson Tinoco

"andrey2001" wrote:

Hola Grupo...

Estoy tratando de crear funciones definidas por el usuario y al crear
esta...

CREATE FUNCTION bd.dbo.fnsaldo (@cedula varchar(11))
RETURNS money AS
BEGIN
select sum(cursaldo) from tbldoc where strtipdoc='FC' and strcodca=@cedula
END

me da estos errores

"error 170. line 1.incorrect syntax near "function".
must declare the variable '@cedual'

Que pasara...?

Gracias de antemano...



Preguntas similares