今天快被这个问题搞死掉了
公司需要把数据从 MsSQL 转到 MySQL,转过去的数据始终是不完整的。就像被人从中间故意截断的一样。
先是考虑是 MsSQL 的问题,用它自身的查询分析器查询却没问题。可是用PHP写的脚本来查就有问题。
通知了我们的网管,检查了半天也没有查出来什么问题。后来忽然间就想到了是不是PHP中的限制。打开PHP.ini,仔细找了一下,果然有类似于下面的一段:
[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = On
; Maximum number of persistent links. -1 means no limit.
mssql.max_persistent = -1
; Maximum number of links (persistent+non persistent). -1 means no limit.
mssql.max_links = -1
; Minimum error severity to display.
mssql.min_error_severity = 10
; Minimum message severity to display.
mssql.min_message_severity = 10
; Compatability mode with old versions of PHP 3.0.
mssql.compatability_mode = Off
; Connect timeout
;mssql.connect_timeout = 5
; Query timeout
;mssql.timeout = 60
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textlimit = 4096
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textsize = 4096
; Limits the number of records in each batch. 0 = all records in one batch.
;mssql.batchsize = 0
; Specify how datetime and datetim4 columns are returned
; On => Returns data converted to SQL server settings
; Off => Returns values as YYYY-MM-DD hh:mm:ss
;mssql.datetimeconvert = On
; Use NT authentication when connecting to the server
mssql.secure_connection = Off
; Specify max number of processes. Default = 25
;mssql.max_procs = 25
罪魁祸首我已经在上边用红色标出来了。索性把它改为最大 2147483647,再次查询后,一切正常。