Quantcast
Channel: Latest Questions by aRookieBIdev
Viewing all articles
Browse latest Browse all 76

XML fields to data set

$
0
0
All, I am stuck with the SQL xml scenario. Any ideas or help will be much appreciated I have xml fields in several tables which has data in the root node Basically I want a single dynamic query that would get me the result in a data set when run against the two tables The definition of the xml field in the tables varies for each table and are not known. From the example script provided below, From Table A i need the result set ID,ClientID,Title From Table B i need the result set ID,ClientID,Value CREATE TABLE [TableA] ( [ID] [bigint] IDENTITY(1,1) NOT NULL, [TestXML] XML ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] CREATE TABLE [TableB] ( [ID] [bigint] IDENTITY(1,1) NOT NULL, [TestXML] XML ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] INSERT INTO [dbo].[TableA] ([TestXML]) VALUES ('1AAAAXXXX') GO INSERT INTO [dbo].[TableA] ([TestXML]) VALUES ('2BBBBYYYYY') GO INSERT INTO [dbo].[TableB] ([TestXML]) VALUES ('1AAAAXXXX') GO INSERT INTO [dbo].[TableB] ([TestXML]) VALUES ('2BBBBYYYYY') GO SELECT * FROM [dbo].[TableA] SELECT * FROM [dbo].[TableB]

Viewing all articles
Browse latest Browse all 76

Trending Articles