Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 28th, 2006, 05:49 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Pain

guys,

I have bunch of tables and what i need to do is get xml data from all the tables and insert into a main table. I tried using for xml raw, it throws me an error say its not allowed in insert statement.

Any suggestions? Thanks
 
Old December 29th, 2006, 04:16 AM
Registered User
 
Join Date: Dec 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried to use SSIS (SQL Server Integration Services), it have a bunch of predefined tasks that you can use, furthermore you may want some data transformation..

If you prefer not to use SSIS this script may give you an idea:
(it creates a sample table with one column of xml datatype in populate it from other table that stores xml data, the key is using insert into tablename SELECT ...)

USE AdventureWorks
GO

CREATE TABLE dbo.SampleXMLTable
    (
    XMLData xml NULL
    ) ON [PRIMARY]

GO


INSERT INTO dbo.SampleXMLTable
SELECT AdditionalContactInfo FROM Person.Contact
WHERE AdditionalContactInfo IS NOT NULL

GO

SELECT * FROM dbo.SampleXMLTable


Best regards,


Marko Jagodic,
Pexim Solutions, Serbia
 
Old January 3rd, 2007, 04:50 PM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

not a likely problem but a possible one is that you may have special characters in your xml data that can not be inserted into a sql table. I ran across this once. Sql does not accept all ascii values.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Pain: A touch-up on Beginning JSP Chapter 23 Swede BOOK: Beginning JavaServer Pages 1 January 12th, 2014 10:59 AM
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
VB.net, adding XML data to an existing XML file saikoboarder XML 11 April 17th, 2008 04:19 PM
xml invalid top level from ASP write XML(solution) g000we XML 0 August 9th, 2006 03:56 AM
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.