|
Posted by Gert-Jan Strik on 07/20/07 22:14
Hugo Kornelis wrote:
>
> On Fri, 20 Jul 2007 09:39:44 -0700, Carsten wrote:
>
> >Hello Folks,
> >
> >I encountered a problem with SQL server 2000 and UDFs.
> >
> >I have a scalar UDF and a table UDF where I would like the scalar UDF
> >to provide the argument for the table UDF like in:
> >
> >SELECT
> > *
> >FROM
> > transaction_t
> >WHERE
> > trxn_gu_id in (
> > select get_trxns_for_quarter(get_current_quarter( GetDate() ) )
> > )
> >
> >'get_current_quarter' returns an integer which is a GUID in a table
> >containing business quarter definitions, like start date, end date.
> >'get_current_quarter' is a scalar UDF.
> >'get_trxns_for_quarter' will then get all transctions that fall into
> >that quarter and return their GUID's in a table.
> >'get_trxns_for_quarter' is a table UDF.
>
> Hi Carsten,
>
> You need to select from a table-valued function. And you need to
> schema-qualify UDF's.
Hugo, you are right (as usual). The trick is in schemabinding the scalar
UDF (and addressing the UDF with its 2-part name).
Do you have any documentation or BOL reference that specifies that
schemabinding is required? Because I don't understand why this would be
relevant.
Thanks,
Gert-Jan
Navigation:
[Reply to this message]
|