Thanks for the reply Sergey, I found out I was using a wrong syntax, this solved my problem:
SELECT dias FROM dbo.Fn_Dias('2', '020001')
Rookie's mistake :)
Enmanuel
>Enmanuel,
>
>The error message means that UDF cannot be found for whatever reason. You can use ENterprise Manger or Query Anlyzer Object Browser to see if UDF exists in the Database.
>
>>Hi all, I've created an UDF but when trying to access it I'm getting the error message
>>
>>Server: Msg 208, Level 16, State 1, Line 1
>>object name 'dbo.fn_dias' is invalid.
>>
>>to call the udf I'm using:
>>
>>select dbo.fn_dias('2','210001')
>>
>>
>>and here's the code:
>>
>>CREATE FUNCTION dbo.Fn_Dias (@pCuenta varchar(5),@pTipoMovi varchar(6))
>>RETURNS table
>> AS
>>return SELECT DATEDIFF(Day, (SELECT Fecha
>> FROM Transac01
>> WHERE Documento = Transac02.documento1 AND
>> Tipomovi = Transac02.Tipomovi1), fecha) as dias
>>FROM TRANSAC02
>>WHERE (cuenta = @pCuenta) AND (tipomovi = @pTipoMovi)
>>
>>
>>
>>At this time I just don't know what I'm doing wrong, so I'd appreciate any help!
>>
>>
I'm a mixture of Albert Einstein and Arnold Schwarzenegger. The only trouble is that I got Einstein's body and Schwarzenegger's brain