Thursday, September 24, 2009

70-433 SQL Server XML Indexes - basic usage examples

The emp table has two columns "xml data type" columns: emp_xml & dept_xml


each column have it's own "PRIMARY XML INDEX" and then also multiple (secondary) "XML INDEX" (FOR PATH, FOR VALUE or FOR PROPERTY)


CREATE PRIMARY XML INDEX emp_xml_pri ON emp(emp_xml);

CREATE XML INDEX emp_xml_value ON emp(emp_xml) USING XML INDEX emp_xml_pri FOR VALUE;

CREATE XML INDEX emp_xml_path ON emp(emp_xml)  USING XML INDEX emp_xml_pri FOR PATH;

CREATE XML INDEX emp_xml_prop ON emp(emp_xml)  USING XML INDEX emp_xml_pri FOR PROPERTY;




No comments: