0

codeigniter で 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で完全に正常に機能しています。

しかし、Codeigniter を使用して同じクエリを実行しようとすると、次のエラーが発生します:--

Unicode のみの照合順序の Unicode データまたは ntext データは、DB-Library (ISQL など) またはODBC バージョン 3.7 以前を使用してクライアントに送信することはできません。

4

1 に答える 1

1

php.netでいくつかの解決策を見つけました

  1. MSSQLNewbie2011年9月19日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. iteamsdotorgのdanndotfarquhar2009年9月24日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. hotmaildotcomのhuberkev112006年5月12日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
    

彼らが助けてくれることを願っています。

于 2012-12-12T09:11:01.010 に答える