???? ???? ????? ??? ??????? XQuery ??????? ???? ???? XML ?? SQL Server 2005

?????? ????????? ?????? ?????????
???? ???????: 914638 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???: 20011171 (SQLBUDT)
????? ???? | ?? ????

?? ??? ??????

???????

???? ???? ????? ??? ??????? XQuery ??????? ???? ???? XML ??? ?????? ???????:
  • ?? ????? ???? XML ???? ???? ????? ????? ???? ?? ????? ?????? ???????.
  • ???? ????? ?????? ????? ???? XML ?? ????? ?????? ???????? ??????.
  • ????? ??????? ???? ?????? ??????? ???? ???? XML.

?????

???? ??? ??????? ???? ?????? ???? ???? XML ????? ????? ??? ???? XML ??? ???? XML ??? ??????? ?? ???? ???? ????? ???? ???? ????? ???????. ????? ?? ???? ??????? ???? ?????? ?????? ???????? ???? XML. ???? ???? ??? ?????? ???? ???? XML ????? ????? ??????? ???? XML.

????

??????? ???? ??????

??? ??? ???????? ??? ?????? ??? ???? ???? ???? ?? Microsoft SQL Server 2005. ????? ?? ?????????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
913089????? ?????? ??? ???? ???? ???? ?? SQL Server 2005

???? ??????

??????? ?????? ??? ??? ??????? ???? ??????? ???????:
  1. ??? ????? ???? ?????? ????? ??? ????? ???????? ?????? ?? ?????? ?? ??? ????? ????? ?????? ???? XML. ??? ????? ??? ?????? ?????? ?? ???? XML ????? ??? ?????? XML ????. ?????? ????? ?????? ????? SQL ???????? ?????? ??? ???: GO XML
    ALTER TABLE <TableName> ALTER COLUMN <ColumnName> XML
    GO
    
  2. ????? ?????? ???? XML ???????. ?? ?? ?????? ?????? ???? XML ???? ????? ??? ????? ??? ??? ?? ???? XML ?????? ???? ??? ??? ??? ????? ???? ????? ?????? ????? ???? XML ??? false. ?????? ????? ?????? ????? SQL ???????? ?????? ??? ???:
    DROP XML SCHEMA COLLECTION <OldSchemaName>
    GO
    
    CREATE XML SCHEMA COLLECTION <NewSchemaName> AS N?<NewSchemaDefinition>?
    GO
    
  3. ????? ???? ?????? ??? ???? XML ????? ??????? ?? ??? ????? ?????? ???? XML ???? ??? ????. ?????? ????? ?????? ????? SQL ???????? ?????? ??? ???:
    ALTER TABLE <TableName> ALTER COLUMN <ColumnName> XML(<NewSchemaName>)
    GO
    
??????<TableName> ???? ??? ??????. <ColumnName> ???? ??? ???? ?????? XML. <OldSchemaName> ???? ??? ?????? ???????? ????? ??????. <NewSchemaName> ???? ??? ?????? ???? ????. <NewSchemaDefinition> ???? ??????? ???? ?????? ???? ????.

?????

???? Microsoft ?? ??? ????? ?? ?????? Microsoft ??????? ?? ??? "????? ???". ?? ????? ??? ??????? ???? ??? ?? Microsoft SQL Server 2005 ?????? ????? ?????? Service Pack 1.

??????? ????

??? ???? ????? ??? ????? ???? ?? ???? ?????? ???? ????? ????? ?? ????? ?????? ??? true. ?????? ????????? ??? ???? ???? XML ???? ????? ??? ???? ??? "????? ???? ??? ????????" (W3C) ????? ??? ???????. ????? ?? ?????????, ???? "3.4.3" ??? ? "3.4.4" ?????? ?? ???? ??? ??????:
http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions

????? ????? ????? ???????

  1. ???? SQL Server 2005 ????? Studio.
  2. ??????? ????? SQL Server.
  3. ?? ?????? ????? ?????? ?? ???? ??? ????? ?????? ???? ???? ???????.
  4. ?? ??????? ???? ??? ??? ???? ?? ???? ??? ??????? ???? ????? ??????. ???? ???? ???? ?????????.
  5. ??? ???? ???????? ???????? ??????? ?? ???? ???? ???????:
    create xml schema collection myschema as N'
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    	<xs:element name="ElementName" type="xs:integer" />
    		
    	<xs:complexType name="newct" mixed="true">
    		<xs:simpleContent>
    			<xs:extension base="xs:integer">
    				<xs:attribute name="bar" type="xs:integer" />
    			</xs:extension>
    		</xs:simpleContent>
    	</xs:complexType>
    </xs:schema>'
    go
    
    create table xml_test (pk int primary key identity(1,1), xmlcol xml(myschema))
    go
    
    insert xml_test values ('
    <ElementName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="newct" bar="10">30</ElementName>')
    go
    
    insert xml_test values ('
    <ElementName>30</ElementName>')
    go
    
    select xmlcol.query('data(/ElementName)')
    from xml_test
    
??????? ????? ??? ???:
<empty>
30
?????? ?? ??? ??????? ? <empty>???? ??? ???? ?? ???.

??? ???? ??? ??????? ?? ??????? ?? ???? ?????? ??? ???:
30
30

?????

?????? ??? ???? ?? ????????? ??? ???? ???????? XQuery ?? ?????? ???? ???? ????? Microsoft (MSDN) ?????? ??? ?????:
http://msdn2.microsoft.com/en-us/library/ms187038.aspx

???????

???? ???????: 914638 - ????? ??? ??????: 08/???? ?????/1427 - ??????: 2.3
????? ???
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Workgroup Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
????? ??????: 
kbmt kbsql2005presp1fix kbsql2005xml kbsql2005tsql kbexpertiseadvanced kbtshoot kbprb KB914638 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????914638

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com