DECLARE @xml XML
SET @xml = '
<Students>
    <Student  id="1001" name = "xu">
        <name>aaa</name>
        <age>20</age>
        <birthday>1991-2-20</birthday>
    </Student>
    <Student  id="1002">
        <name>bbb</name>
        <age>21</age>
        <birthday>1990-2-20</birthday>
    </Student>    
</Students>
'
DECLARE @idoc INT ;
EXEC sp_xml_preparedocument @idoc OUTPUT, @xml ;
SELECT  *
FROM    OPENXML(@idoc,'/Students/Student') WITH
(
id INT ,
name VARCHAR(20) 'name',
age INT 'age',
birthday VARCHAR(20) 'birthday'
)
PRINT @idoc
EXEC sp_xml_removedocument @idoc

05-11 19:36