473,503 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retieving data with "for xml"

I execute a simple query with "for xml auto".
One of the fields in my table is "char" type and has a blank value.
when the query gets to this field the xml construction stops.
such that it creates the following , where "core" is the field of type
"char". What is the problem

<tablename company_id="1119" group_id="0" ideal="0" core="

Jul 23 '05 #1
1 1606
(jw*****@gmail.com) writes:
I execute a simple query with "for xml auto".
One of the fields in my table is "char" type and has a blank value.
when the query gets to this field the xml construction stops.
such that it creates the following , where "core" is the field of type
"char". What is the problem

<tablename company_id="1119" group_id="0" ideal="0" core="


The blank value is most likely a NULL character. It appears that SQL2000
does not handle this correctly. Here is a repro:

CREATE TABLE a (a int not null, b varchar(12) NOT NULL)
go
INSERT a (a, b) values (1, '23')
INSERT a (a, b) values (2, '')
INSERT a (a, b) values (3, ' ')
INSERT a (a, b) values (4, char(0))
INSERT a (a, b) values (5, '//')
go
select * from a for xml auto
select b, a from a
go
drop table a

I tried the same in SQL 2005, which gives this correct result:

<a a="1" b="23"/><a a="2" b=""/><a a="3" b=" "/><a a="4" b="&#x00;"/><a a="5" b="//"/>
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2115
by: Roy Smith | last post by:
I'm working on a prototype of a new application in Python. At some point, if this ever turns into a product, the powers that be will almost certainly demand that it be done in Perl. My job will...
1
2390
by: Max Favilli | last post by:
Hello everybody, I have just installed mysql to evaluate it, I have an application based on mssql which extensively use the "for xml" clause to retrieve data from the db as xml well formed...
1
1150
by: ouioui2000 | last post by:
Hi, I try to generate xml flow with javascript in a new windows. Here is my javascritp code : <code> fenetrePopUp =...
6
2583
by: Bart van Deenen | last post by:
Hi All I'm happily creating an Ajaxified web-app. I use Prototype for encapsulating xml http requests, with method "post". On the backend, I use PHP, and the replies are eval'd by Javascript. I...
2
3157
by: jwalton | last post by:
I have a web site (for a client) where I am now using a considerable number of XML files. Previously the files were updated off-line, and FTPd to make live. I now need to allow "user editors" to...
6
5088
by: alederer | last post by:
Hallo! I have a table tstest(ts char(13) for bit data constraint a unique). This column is filled in a trigger with generate_unique(). In a application (CLI), I have the values of this...
11
2621
by: ajikoe | last post by:
Hello, I used Visual C# Standard Edition. I want to comment my program using xml commentary method, I don't know why if I use value and example tag, it is not working / showed in the html...
1
2329
by: VB Programmer | last post by:
When my users login I want them to be able to change some of their personal info in a db. I want to use a detailsview control for this. How can I get the detailsview to only pull up the record...
0
1637
by: Gawn | last post by:
Dear all, Greeding from Thailand. Need help for my news script. I am trying to display news which keywords match the current page keywords. I am using Dreamweaver 8 and PhpMyAdmin to manage MySQL....
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7453
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.