Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 "WITH Allowed" Syntax in Create Function Statement

Author  Topic 

ecomajor
Starting Member

12 Posts

Posted - 2009-02-06 : 10:13:17
I have looked through the SQL Syntax books and can not figure out what the syntax in read means

ALTER FUNCTION XXX.funcname (@usr varchar(255))
RETURNS TABLE
AS
RETURN (
WITH
Allowed
( FieldA, FieldB, FieldC)
AS .....

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-06 : 10:15:50
that's called CTE (common table expression)

http://msdn.microsoft.com/en-us/library/ms190766.aspx
Go to Top of Page

ecomajor
Starting Member

12 Posts

Posted - 2009-02-06 : 13:22:12
Is this a new feature. I never saw this feature before. Its perhaps one of the most useful things ever in SQL to solve a very complex problem of traversing hierarchies.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-07 : 08:34:31
yup..its a new feature from 2005 onwards. Yeah, its major advantages is ability to handle recursive queries.
Go to Top of Page
   

- Advertisement -