note 71602 added to ref.mssql

From: Date: Thu, 07 Dec 2006 11:38:13 +0000
Subject: note 71602 added to ref.mssql
Groups: php.notes 
Request: Send a blank email to php-notes+get-120369@lists.php.net to get a copy of this message
About using the MSSQL XML field-type, for Win32 users, : 1. The most simple way would be to "SELECT [xmlfield] FROM [table]" But this triggers the following error : "Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16)" 2. Well, let's just read [xmlfield] as a VARCHAR. "SELECT CAST([xmlfield] AS VARCHAR(8000)) FROM [table]" will truncate to the 255 first characters, due to the API limitation. (see the marc at NOSPAM dot durdin dot net note) 3. So woud not that be appropriate to use the TEXT field-type ? "SELECT CAST([xmlfield] AS TEXT) FROM [table]" triggers : "Explicit conversion from data type xml to text is not allowed. (severity 16)" 4. So you cannot read the VARCHAR nor the XML, and you cannot transform the XML into TEXT. In order to finally read that XML field-type, you may use this trick : "SELECT CAST(CAST([xmlfield] AS VARCHAR(8000)) AS TEXT) FROM [table]" ---- Server IP: 217.174.203.10 Probable Submitter: 217.109.152.93 (proxied: 1.1 R2D2) ---- Manual Page -- http://www.php.net/manual/en/ref.mssql.php Edit -- https://master.php.net/note/edit/71602 Del: integrated -- https://master.php.net/note/delete/71602/integrated Del: useless -- https://master.php.net/note/delete/71602/useless Del: bad code -- https://master.php.net/note/delete/71602/bad+code Del: spam -- https://master.php.net/note/delete/71602/spam Del: non-english -- https://master.php.net/note/delete/71602/non-english Del: in docs -- https://master.php.net/note/delete/71602/in+docs Del: other reasons-- https://master.php.net/note/delete/71602 Reject -- https://master.php.net/note/reject/71602 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120369) next »