You are here: Re: Problem with nested function call (UDFs) « MsSQL Server « IT news, forums, messages
Re: Problem with nested function call (UDFs)

Posted by Hugo Kornelis on 07/22/07 22:56

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация