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
('1 AAAA XXXX ')
GO
INSERT INTO [dbo].[TableA]
([TestXML])
VALUES
('2 BBBB YYYYY ')
GO
INSERT INTO [dbo].[TableB]
([TestXML])
VALUES
('1 AAAA XXXX ')
GO
INSERT INTO [dbo].[TableB]
([TestXML])
VALUES
('2 BBBB YYYYY ')
GO
SELECT * FROM [dbo].[TableA]
SELECT * FROM [dbo].[TableB]
↧