Home > Net >  Calling Table-valued Function with inline convert parameter
Calling Table-valued Function with inline convert parameter

Time:01-12

I have an error in some sql server installation while calling a Table-valued Function and try to convert the parameter inline.

SELECT *
FROM myFunction(CONVERT(NVARCHAR(MAX), @value1)) 

The error returned is Incorrect syntax near the keyword 'CONVERT'.

The function works without Convert.

SELECT *
FROM myFunction(@value2) 

the sql server version is

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Express Edition (64-bit) on Windows NT 6.2 (Build 9200: )

Is there any setting to fix it ?

CodePudding user response:

Thanks to @MartinSmith and @Larnu.

The problem was due by the database compatibility mode set to 80 (SQL Server 2000)

  • Related