2012-12-12 67 views
0

我正在使用笨的SQL Server數據庫驅動程序,我執行以下查詢:笨錯誤與SQL Server

select A.inst_name,Substring((Select ',' + cast(B.program_id as varchar(15)) 
           From k12_dms_inst_programs B 
           Where B.inst_id=A.id For XML Path('')),2,8000) As EmployeeList 
From k12_dms_institution_master A 
Group by A.inst_name,A.id 

這是工作在SSMS精絕。

但是,當我試圖執行使用笨我收到以下錯誤相同的查詢: -

在僅Unicode歸類或ntext數據Unicode數據不能被髮送到使用的DB-Library客戶(如ISQL)或ODBC版本3.7或更低版​​本

回答

1

上發現php.net一些解決方案

  1. MSSQLNewbie 19月 - 2011 06:34

    In /etc/freetds/freetds.conf add these two lines (last two): 
    [global] 
    ;tds version = 4.2 
    tds version = 8.0 
    client charset = UTF-8 
    
    You can edit "charset" in php.ini too (but you don't need if you did it previously in freetds.conf): 
    ; Specify client character set.. 
    ; If empty or not set the client charset from freetds.comf is used 
    ; This is only used when compiled with FreeTDS mssql.charset = "UTF-8" 
    
    Use nchar/nvarchar/ntext column types if you need unicode support. 
    
  2. 在iteams丹恩點法夸爾點組織24月,2009年11:45

    I found that changing the version in /etc/freetds.conf from 4.2 to 8.0 
    fixes this problem without having to make any changes to the SELECT 
    statement 
    
  3. huberkev11在Hotmail點com 12日,2006年01:47

    This is because you are using column types of like ntext instead of 
    text. There are 2 solutions. 
    
    1 Change all ntext column types to text or 
    2 Your query must look like: SELECT CAST(field1 AS TEXT) AS field1 FROM table 
    

希望他們會幫助。

+0

非常感謝您的幫助! – user1163513

+0

@ user1163513告訴我們他們哪些幫助你! –

+0

對我來說,它是第一個工作。 – user1163513