Larry Brister
asked on
SQL Server parse XML
The SQL below builds a test XML variable
WHat I need to do in SQL Server is loop through the nodes...
For EACH demovalue... in @XMLVar
Declare @IndividualID INT
Declare @CustomID INT
Declare @Commentsl VARCHAR (100)
SET @IndividualID = @XMLVar.....demovalues/dem ovalue/ind ..value
Set @Comments = @XMLVar.....demovalues/dem ovalue/val ..value
Set @CustomID = (Select id from myDemoTable where DemoText = )
(I know I butchered that...)
And then,,,
INSERT INTO indDemoTable (IndividualID, CustomID, Comments)
Select @IndividualID, CustomID, @Comments
WHat I need to do in SQL Server is loop through the nodes...
For EACH demovalue... in @XMLVar
Declare @IndividualID INT
Declare @CustomID INT
Declare @Commentsl VARCHAR (100)
SET @IndividualID = @XMLVar.....demovalues/dem
Set @Comments = @XMLVar.....demovalues/dem
Set @CustomID = (Select id from myDemoTable where DemoText = )
(I know I butchered that...)
And then,,,
INSERT INTO indDemoTable (IndividualID, CustomID, Comments)
Select @IndividualID, CustomID, @Comments
DECLARE @XMLVar XML
SET @Var = '<demovalues><demovalue><ind>123456</ind><id>holder</id><val>TEST TEXT 33</val></demovalue><demovalue><ind>123457</ind><id>holder</id><val>TEST TEXT 34</val></demovalue></demovalues>'
SELECT @Var
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This was exactly what I needed