3

我正在使用 UniVerse ODBC 驱动程序将数据从我们的事务系统提取到 SQL Server 2008。ODBC 驱动程序安装在 Windows Server 2003 上并且工作正常。我试图在编写标量函数(如 CONVERT)的语法上找到一些帮助。

当我浏览手册时,我发现该功能是受支持的。但是当我尝试写一个查询时

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

查询因语法错误而失败。我怀疑 ODBC 驱动程序不支持这种语法。对此的任何帮助将不胜感激。谢谢。

4

1 回答 1

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

于 2012-04-04T18:30:22.663 回答