3

I am using the UniVerse ODBC driver to pull data from our transactional system to SQL Server 2008. The ODBC driver is installed on Windows Server 2003 and it works fine. I am trying to find some help on the syntax for writing the scalar functions such as CONVERT.

As I went through the manual, I found that the function is supported. But when I try to write a query like

SELECT CONVERT(ID AS VARCHAR(10)) FROM TableName

the query fails with syntax error. I am suspecting that the ODBC driver does not support this syntax. Any help with this will be highly appreciated. Thanks.

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
rvphx
  • 2,324
  • 6
  • 40
  • 69

1 Answers1

6

You will need to format your scalar functions like so:

{fn CONVERT(EXAMPLEFIELD, SQL_VARCHAR )}

Therefore, your completed query may look like:

SELECT {fn CONVERT(ID, SQL_VARCHAR )} FROM TableName

I tested a similar query through my ODBC connection to Universe and it did not result in a syntax error.

I found the following article from Microsoft about ODBC explicit conversions to be helpful: http://msdn.microsoft.com/en-us/library/windows/desktop/ms715381(v=vs.85).aspx

webthaumaturge
  • 1,198
  • 1
  • 11
  • 23