Nested functions in T-sql - TechRepublic
Question
April 30, 2008 at 09:34 AM
jgg2008

Nested functions in T-sql

by jgg2008 . Updated 18 years, 2 months ago

Hi, I am trying to call a scalar user function
from an inline function, but it is not working.
If I declare a variable and assign the function
to it, it works!, but when I try to call the function directly from another function, I get
an error. The code is the following:

Declare @fecha1 datetime
Declare @fecha2 Datetime

Set @fecha2 = ’10/02/2008′
— if I use the function here, it is fine
Set @fecha1 = dbo.MesUnoStr(@fecha2)
Select * From Prop_MP_Per(@fecha1,@fecha2)

— but if I use the function inside another
— (as a parameter) I get a parse error
— (before actually executing the code)
Select * From Prop_MP_Per(dbo.MesUno(@fecha2),@fecha2)

I appreciate If someone could help me.

Thanks for your help!!

This discussion is locked

All Comments