Search This Blog

Thursday, March 11, 2010

If it is intended as a parameter to a table-valued function, ensure that your database compatibility mode is set to 90.

if your database compatibility mode is not set to 90 then the below query

declare @d table (a varchar(10), b varchar(20))

insert into @d
values(11111,'1,23,4')
insert into @d
values(11112,'11,231,41')

select a, c.val
from @d cross Apply
fnStringtoTable( b ) c

will throw an error:

"b" is not a recognized table hints option. If it is intended as a parameter to a table-valued function, ensure that your database compatibility mode is set to 90.

If above error comes then do as follows:
EXEC sp_dbcmptlevel 'EZTEST' , 90
GO
declare @d table (a varchar(10), b varchar(20))

insert into @d
values(11111,'1,23,4')
insert into @d
values(11112,'11,231,41')

select a, c.val
from @d cross Apply
fnStringtoTable( b ) c

For More details visit here http://blogs.msdn.com/psssql/archive/2007/10/16/database-compatibility-and-new-features.aspx

Output:















ab
111111
1111123
111114
1111211
11112231
1111241

No comments:

Post a Comment