cancel
Showing results for 
Search instead for 
Did you mean: 

change SQL server keyword to sybase keyword

Hazeleena
Explorer
0 Kudos
492

i have this select query below.

SELECT @ColumnName = ISNULL(@ColumnName + ',', '') + QUOTENAME(TestName) FROM (SELECT DISTINCT [TestName] FROM #Test t INNER JOIN #Marks m ON m.TestID =t.TestID WHERE Semester = @Semester) AS [TestName]

Sybase give this error : Function 'QUOTENAME' not found. If this is a SQLJ function or SQL function, use sp_help to check whether the object exists (sp_help may produce a large amount of output).

how this fix this.. Thank you

Accepted Solutions (0)

Answers (2)

Answers (2)

awitter
Participant
0 Kudos

What are you trying? This looks very complicated just to get all the test names... How about:

select list(distinct TestName) into @ColumnName from #Test inner join ...

or, if you need the quotes and maybe sorted:

select list(distinct '''' || TestName'''' order by TestName) into @ColumnName from #Test inner join ...
VolkerBarth
Contributor
0 Kudos

AFAIK, there's no QUOTENAME() or according builtin function in SQL Anywhere. However, QUOTENAME() is basically a rather simple function that adds the specified quote characters (default open resp. closing square brackets) before and after the parameter, even if the parameter itself would do as an identifier. So you could simple use

@ColumnName = string('[', YourUnquotedColumnName, ']') FROM...

to have something comparable.