473,569 Members | 2,751 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="111 9" group_id="0" ideal="0" core="

Jul 23 '05 #1
1 1611
(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="111 9" 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****@sommarsk og.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
2121
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 be to convince them otherwise. The basic design of the application is object oriented. I've never used Perl's OO features, so I'm not in a good...
1
2397
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 document (actually "for xml explicit"). How can I do the same thing with mysql? I understood there's no native support for retrieving data as xml...
1
1163
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 = window.open('','_blank','width=500,height=300,scrollbars=yes,status=yes,resizable=yes'); fenetrePopUp.document.open("application/xml+xsl"); fenetrePopUp.document.write(myCodeXML); </code>
6
2588
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 do not use XML for data encapsulation. The only thing that is off nominal is that my Firefox 1.07 (Mac OS-X) and 1.06 (Linux) have "Waiting for...
2
3160
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 edit the XML data. These users are primarily "business knowledge" experts; intelligent but not necessarily IT literate. I need to provide a simple...
6
5096
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 column as timestamp representation: e.g.: select timestamp(ts) from tstest 1
11
2632
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 result. for example I have Property ///<value>this is in description</value> ///<example>this is in Example</example> public int A{
1
2333
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 based on their USERID ("current user")? This SqlDataSource doesn't seem to return anything... <asp:SqlDataSource ID="SqlDataSource1"...
0
1645
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. May I explain you what I have done. My database and data in that look like this. //* Data Base -- phpMyAdmin SQL Dump -- version 2.6.2-pl1 --...
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5504
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.