今天很鬱悶,pymssql 出問題了 Text 欄位不能超過4K(4096)個字元

來源:互聯網
上載者:User

    pymssql 使用一段時間了, 因為沒有使用太複雜的語句,一直還比較正常,但是今天在讀取一些較大文本時出現了問題,只擷取了部分文本,資料被強行截斷了。

    簡單計算了一下,欄位不能超過4096個字元,也就是4K。

    select convert(varchar(50),guid) as guid, convert(text,content) as content from news

     Google Baidu 了一把,據說是 SET TEXTSIZE 65536  就可以了,但是我試過不行,只好到 官方網站 上看

  • important doc update: documented that with the technology pymssql currently uses (DB Library for C), it is not possible to read or write BLOBs longer than 4096 bytes,

  • varchar and nvarchar data is limited to 255 characters, and longer strings are silently trimmed.
    This is known limitation of TDS protocol. A workaround is to CAST or CONVERT that row or expression to text data type, which is capable of returning 4000 characters.

 

     貌似說 pymssql  使用 DB Library for C ,讀取比4K 大的資料是不可能的, 哎,啥也別說了,準備換吧。

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.