Re: Problem with nested function call (UDFs)
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Jul 2007 00:56:55 +0200
On Sun, 22 Jul 2007 00:42:01 +0200, Gert-Jan Strik wrote:
Sorry about the confusion. I first tested on SQL Server 2000 and later
(when Hugo gave a reply) I retested on 2005.
In SQL Server 2005, this all works just fine. All you need to do is
access the scalar UDF with its 2-part name.
However, in SQL Server 2000 (the OP's platform), it doesn't work.
Calling it with the 2-part name gives the error "Incorrect syntax near
'.'", calling it with the 1-part name gives the error "Incorrect syntax
near '('.". Schemabinding doesn't make a difference.
Hi Gert-Jan,
I missed both the requirement of the OP that it run under SQL2000 and
the odd behaviour on that platform.
I can confirm the same behaviour here. And I can't find any explanation
in Books Online. I guess it's a bug - but not one I expect to ever see
fixed.
The workaround is of course simple:
DECLARE @d datetime
SET @d = dbo.get_current_quarter(GetDate())
SELECT id, dt
FROM (SELECT 1, CAST('20070701' AS datetime)
UNION ALL
SELECT 2, CAST('20070815' AS datetime)) AS t(id, dt)
WHERE dt IN (SELECT TheDate
FROM dbo.get_trxns_for_quarter(@d));
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
.
- Follow-Ups:
- Re: Problem with nested function call (UDFs)
- From: Carsten
- Re: Problem with nested function call (UDFs)
- References:
- Problem with nested function call (UDFs)
- From: Carsten
- Re: Problem with nested function call (UDFs)
- From: Hugo Kornelis
- Re: Problem with nested function call (UDFs)
- From: Gert-Jan Strik
- Re: Problem with nested function call (UDFs)
- From: Hugo Kornelis
- Re: Problem with nested function call (UDFs)
- From: Gert-Jan Strik
- Problem with nested function call (UDFs)
- Prev by Date: Re: contents of image fields
- Next by Date: MS SQL Express Advanced vs MS SQL full version vs MySQL
- Previous by thread: Re: Problem with nested function call (UDFs)
- Next by thread: Re: Problem with nested function call (UDFs)
- Index(es):
Relevant Pages
|