[英]FreeTDS MSSQL nvarchar(max) issue
I'm pulling out data from an MSSQL server via PDO on a Unix system. 我正在通过Unix系统上的PDO从MSSQL服务器中提取数据。 Having tried the Easysoft ODBC Driver, which works as intended (but expensive!) I'm just trying out FreeTDS before we commit to buying a license.
已经尝试了Easysoft ODBC驱动程序,该驱动程序可以按预期工作(但价格昂贵!),在我们承诺购买许可证之前,我只是在试用FreeTDS。
Trying to pull out data from the SQL server that is set to nvarchar(MAX) - it comes out as some very strange characters, rather than what is expected. 尝试从设置为nvarchar(MAX)的SQL Server中提取数据-它以一些非常奇怪的字符出现,而不是预期的字符。 I am unable to edit the column types in the database.
我无法编辑数据库中的列类型。
For instance, a value in the nvarchar(max) field is set to "admin" but comes out as " ›÷Ý" - all other column types seem to work OK. 例如,nvarchar(max)字段中的值设置为“ admin”,但显示为“›÷Ý”-所有其他列类型似乎都可以正常工作。
To fix this with the Easysoft driver, I had to set "VarMaxAsVarchar" to on ( http://www.easysoft.com/products/data_access/odbc-sql-server-driver/manual/configuration.html ) 要使用Easysoft驱动程序修复此问题,我必须将“ VarMaxAsVarchar”设置为on( http://www.easysoft.com/products/data_access/odbc-sql-server-driver-manual/configuration.html )
Is there a similar setting from within FreeTDS? FreeTDS中是否有类似的设置?
For reference, I am connecting to a Microsoft SQL Server 2012 database, with TDS Version set to 7.4. 作为参考,我正在连接到TDS版本设置为7.4的Microsoft SQL Server 2012数据库。
Here is the config files: 这是配置文件:
/etc/freetds.conf: /etc/freetds.conf:
[global]
# TDS protocol version
tds version = 7.4
# If you get out-of-memory errors, it may mean that your client
# is trying to allocate a huge buffer for a TEXT field.
# Try setting 'text size' to a more reasonable limit
text size = 64512
[mssql_freetds]
host = xxxxx
port = xxxx
tds version = 7.4
/etc/odbc.ini /etc/odbc.ini
[mssql_freetds]
Driver=FreeTDS
Description=MSSQL FreeTDS
Server=xxxxx
Port=xxxx
TDS_Version = 7.4
Any thoughts? 有什么想法吗?
到目前为止,铸造列似乎是最好的选择,对于我的应用程序来说一直很好。
CAST(Column AS varchar(4000)) as Column
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.