July 19, 2004 at 8:25 am
I'm using SELECT ... FOR XML AUTO in QA to return a result set, and saving this to a .XML file (then adding the root node tag). When viewing in IE, I get an error because the result set is split over multiple lines, and a keyword has been cut in the middle.
Could anyone suggest an elegant method for solving this problem? Any input would be much appreciated!
The query I am using in this example is:
SELECT [name], [id], xtype FROM sysobjects FOR XML AUTO
July 19, 2004 at 9:20 am
Try this:
master..xp_cmdshell 'bcp "SELECT [name], [id], xtype FROM sysobjects FOR XML AUTO" queryout "C:\bcptest.rpt" -T -c'
/rockmoose
You must unlearn what You have learnt
July 19, 2004 at 9:46 am
July 19, 2004 at 10:34 am
Would something like this help...
select 'xmlroot>' as Xml_Data
union all
select
'name>'+ltrim(name)+'/name>'+
'id>'+ltrim(id)+'/id>'
-- .........
from dbo.sysobjects
union all
select '/xmlroot>' as Xml_Data
The tags get messed up.. but you get the idea.
/rockmoose
You must unlearn what You have learnt
July 20, 2004 at 1:31 am
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply