Created
December 13, 2013 07:09
-
-
Save venblee/7940825 to your computer and use it in GitHub Desktop.
Select From XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public GetTests (string[] test ) | |
{ | |
Var TestResults = new XElement ("Tests" | |
, test.Select (p => new XElement ("Test" | |
, new XAttribute("TestId",p) | |
) | |
) | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TestResults XML = Null | |
CREATE TABLE #Test | |
{ | |
TestId INT | |
} | |
INSERT INTO #Test(TestId) | |
SELECT c.value ('@TestId[1]' , 'INT' ) AS TestId | |
-- Adding second node , | |
-- c.value ('@TestId[1]' , 'INT' ) AS TestId | |
FROM @TestResults.nodes('/Tests/Test') AS P(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment