SlideShare uma empresa Scribd logo
1 de 17
XML Data Type Methods
    In the Real World
             Steve Hughes
Senior Data Architect, XATA Corporation
Agenda

•   Overview of XML in SQL Server 2005
•   A Case for Using XML in SQL Server
•   Brief Introduction to the XML Data Type
•   XML Data Type Methods with Demos
•   Lessons Learned




      AD-307 • XML Data Type Methods in the Real World
Overview of XML in SQL Server 2005

• XML Data Type
  • XML Data Type Methods
  • XML Schema Collections
• XQuery
  • This allows direct support of XQuery in the .NET Framework
• OPENXML and FOR XML
  • Various improvements in SQL Server 2005
• OPENROWSET
  • Used for bulk operation and was improved in SQL Server 2005
    as well




    AD-307 • XML Data Type Methods in the Real World
A Case for Using XML in SQL Server

• Implementing Multidimensional Arrays
   • Relating multiple unrelated types of data
• Service Broker implementation
   • Extracting XML messages from the broker in the activation
     stored procedure or procedures called by the activation stored
     procedure
• Use in place of comma separated lists
   • Common implementation when sending parameters with multiple
     values




     AD-307 • XML Data Type Methods in the Real World
Introducing XML Data Type Methods

• XML Data Type Methods work against the SQL Server
  XML data type within SQL
• They work with typed and untyped XML
• They work with XML Variables and Columns
• These methods extract or manipulate XML data
• Uses XQuery syntax
• Methods
   •   query
   •   value
   •   exist
   •   modify
   •   nodes


       AD-307 • XML Data Type Methods in the Real World
Query()

• Description
   • Allows you to select data out of the XML data type variable or
     column
   • Returns XML
• Syntax
   • query(‘XQuery’)
• Demo




     AD-307 • XML Data Type Methods in the Real World
Value()

• Description
   • Use this method to query for a scalar value out of the XML
   • It returns most SQL Data Types, the exceptions are:
       •   xml
       •   image
       •   text
       •   ntext
       •   sql_variant
• Syntax
   • value(‘XQuery’, ‘SQL Data Type’)
• Demo




    AD-307 • XML Data Type Methods in the Real World
Exist()

• Description
   • Works similar to the EXISTS statement in T-SQL
   • Returns 1 if the XQuery returns a result
• Syntax
   • exist(‘XQuery’)
• Demo




    AD-307 • XML Data Type Methods in the Real World
Modify()

• Description
   • This method modifies the content of the xml document
      • It can insert, delete and replace values
   • This method can only be used in the SET clause of an UPDATE
     statement
   • This method uses XML Data Manipulation Language (DML) to
     modify the document
• Syntax
   • modify(‘XML_DML’)
• Demos
   • insert
   • delete
   • replace value of


    AD-307 • XML Data Type Methods in the Real World
Nodes()

• Description
   • This method is used to shred XML data into relational data
   • This method returns the data as rowset that can be used like a
     table in T-SQL.
• Syntax
   • nodes(‘XQuery’) as Table(Column)
• Demo




    AD-307 • XML Data Type Methods in the Real World
Using the CROSS APPLY operator

• The APPLY operator allows you to apply a table function
  to a rowset and return the values as a single result set of
  both sets of data
• CROSS APPLY returns the matching records
• Used with the nodes() method and a XML Data Type
  column, you can return shredded XML data with the
  relational data from the same table

• Demo




     AD-307 • XML Data Type Methods in the Real World
Demonstration

Real world implementations
• Parameter for a Stored Procedure
• Used to interpret messages from Service Broker




    AD-307 • XML Data Type Methods in the Real World
Lessons Learned

• Setting options         SET Options             Required Values
    that must be          ANSI_NULLS              ON

    applied               ANSI_PADDING            ON

• Always work with ANSI_WARNINGS                  ON
                          ARITHABORT              ON
   the developers on
                          CONCAT_NULL_YIELD_NULL  ON
   the XML syntax         NUMERIC_ROUNDABORT      OFF
• If you have not         QUOTED_IDENTIFIER       ON
   used XML much, there is a learning curve, be sure to
      account for it.
• It can be difficult to tune queries with XML methods




     AD-307 • XML Data Type Methods in the Real World
Tuning and Performance

• Caveat: This is related to using XML data type for
  passing parameters
• Memory pressure was expected, but not present
• CPU can be heavily utilized for large parsing operations
• Execution plan shows a Table Valued Function for each
  method you use
• Indexes can only be used if the data in the table
• Using schemas will usually hurt performance in this
  scenario as it adds another layer of work for the parser
• Couple of Performance demos




    Session Code • Session Title
Q&A




AD-307 • XML Data Type Methods in the Real World
Additional Resources
• SQL Server 2005 Books Online
   • Search for XML Data Type
• MSDN.microsoft.com
   • Performance Optimizations for the XML Data Type in SQL
     Server 2005 http://msdn2.microsoft.com/en-us/library/ms345118.aspx
   • http://blogs.msdn.com/spal/default.aspx
• Using XML Data Type Methods to query SSIS Packages
   • http://sqlblog.com/blogs/peter_debetta/archive/2006/07/13/Using
     _XML_Data_Type_Methods_to_query_SSIS_Packages.aspx
• Michael Rys’s blog – Musings on XML, XQuery and
  more – He has links to multiple related whitepapers
   • http://sqljunkies.com/weblog/mrys/




     AD-307 • XML Data Type Methods in the Real World
Thank you!

     Thank you for attending this session and the
2007 PASS Community Summit in Denver




  AD-307 • XML Data Type Methods in the Real World

Mais conteúdo relacionado

Mais procurados

Exploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic FunctionsExploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
 
Database Programming
Database ProgrammingDatabase Programming
Database ProgrammingHenry Osborne
 
OOW2016: Exploring Advanced SQL Techniques Using Analytic Functions
OOW2016: Exploring Advanced SQL Techniques Using Analytic FunctionsOOW2016: Exploring Advanced SQL Techniques Using Analytic Functions
OOW2016: Exploring Advanced SQL Techniques Using Analytic FunctionsZohar Elkayam
 
Query hierarchical data the easy way, with CTEs
Query hierarchical data the easy way, with CTEsQuery hierarchical data the easy way, with CTEs
Query hierarchical data the easy way, with CTEsMariaDB plc
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsZohar Elkayam
 
The art of querying – newest and advanced SQL techniques
The art of querying – newest and advanced SQL techniquesThe art of querying – newest and advanced SQL techniques
The art of querying – newest and advanced SQL techniquesZohar Elkayam
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQLRam Kedem
 
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBCBI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBCSimba Technologies
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index TuningManikanda kumar
 
Advanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceAdvanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceZohar Elkayam
 
PL/SQL New and Advanced Features for Extreme Performance
PL/SQL New and Advanced Features for Extreme PerformancePL/SQL New and Advanced Features for Extreme Performance
PL/SQL New and Advanced Features for Extreme PerformanceZohar Elkayam
 
SQL Readable Outputs - Oracle SQL Fundamentals
SQL Readable Outputs - Oracle SQL FundamentalsSQL Readable Outputs - Oracle SQL Fundamentals
SQL Readable Outputs - Oracle SQL FundamentalsMuhammadWaheed44
 
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - ThaiptView, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - ThaiptFramgia Vietnam
 
SQL Server2012 Enhancements
SQL Server2012 EnhancementsSQL Server2012 Enhancements
SQL Server2012 EnhancementsAbhishek Sur
 
Java class 8
Java class 8Java class 8
Java class 8Edureka!
 
SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2MuhammadWaheed44
 

Mais procurados (20)

Exploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic FunctionsExploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic Functions
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
OOW2016: Exploring Advanced SQL Techniques Using Analytic Functions
OOW2016: Exploring Advanced SQL Techniques Using Analytic FunctionsOOW2016: Exploring Advanced SQL Techniques Using Analytic Functions
OOW2016: Exploring Advanced SQL Techniques Using Analytic Functions
 
Query hierarchical data the easy way, with CTEs
Query hierarchical data the easy way, with CTEsQuery hierarchical data the easy way, with CTEs
Query hierarchical data the easy way, with CTEs
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic Functions
 
The art of querying – newest and advanced SQL techniques
The art of querying – newest and advanced SQL techniquesThe art of querying – newest and advanced SQL techniques
The art of querying – newest and advanced SQL techniques
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBCBI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
BI, Integration, and Apps on Couchbase using Simba ODBC and JDBC
 
PostgreSQL - Case Study
PostgreSQL - Case StudyPostgreSQL - Case Study
PostgreSQL - Case Study
 
MySQL Query And Index Tuning
MySQL Query And Index TuningMySQL Query And Index Tuning
MySQL Query And Index Tuning
 
Advanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceAdvanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better Performance
 
Java full stack1
Java full stack1Java full stack1
Java full stack1
 
PL/SQL New and Advanced Features for Extreme Performance
PL/SQL New and Advanced Features for Extreme PerformancePL/SQL New and Advanced Features for Extreme Performance
PL/SQL New and Advanced Features for Extreme Performance
 
SQL Readable Outputs - Oracle SQL Fundamentals
SQL Readable Outputs - Oracle SQL FundamentalsSQL Readable Outputs - Oracle SQL Fundamentals
SQL Readable Outputs - Oracle SQL Fundamentals
 
View, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - ThaiptView, Store Procedure & Function and Trigger in MySQL - Thaipt
View, Store Procedure & Function and Trigger in MySQL - Thaipt
 
SQL Server2012 Enhancements
SQL Server2012 EnhancementsSQL Server2012 Enhancements
SQL Server2012 Enhancements
 
Introduction to (sql)
Introduction to (sql)Introduction to (sql)
Introduction to (sql)
 
Java class 8
Java class 8Java class 8
Java class 8
 
SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2
 

Destaque

MGG495_MarketEntryPlanFinalReport
MGG495_MarketEntryPlanFinalReportMGG495_MarketEntryPlanFinalReport
MGG495_MarketEntryPlanFinalReportRobert Newton
 
APRICOT 2012 - Living with the ever-growing BGP table: an OCN story
APRICOT 2012 - Living with the ever-growing BGP table: an OCN storyAPRICOT 2012 - Living with the ever-growing BGP table: an OCN story
APRICOT 2012 - Living with the ever-growing BGP table: an OCN story直樹 益子
 
Recent Network Trends in Asia and Oceania
Recent Network Trends in Asia and OceaniaRecent Network Trends in Asia and Oceania
Recent Network Trends in Asia and OceaniaAPNIC
 
Network State Awareness & Troubleshooting
Network State Awareness & TroubleshootingNetwork State Awareness & Troubleshooting
Network State Awareness & TroubleshootingAPNIC
 
Learning objectives and goals
Learning objectives and goalsLearning objectives and goals
Learning objectives and goalstjcarter
 
Adlt673 session 5_quantitative_validity_practicatility - class 5
Adlt673 session 5_quantitative_validity_practicatility - class 5Adlt673 session 5_quantitative_validity_practicatility - class 5
Adlt673 session 5_quantitative_validity_practicatility - class 5tjcarter
 
New Market Evaluation Strategy Guide
New Market Evaluation Strategy GuideNew Market Evaluation Strategy Guide
New Market Evaluation Strategy GuideMyNOG
 
Martha septiningtyas second language acqusition
Martha septiningtyas second language acqusition Martha septiningtyas second language acqusition
Martha septiningtyas second language acqusition Martha Septiningtyas II
 
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...Mari Hansen
 
approaches to curriculum design
approaches to curriculum designapproaches to curriculum design
approaches to curriculum designNasrin Eftekhary
 

Destaque (16)

MGG495_MarketEntryPlanFinalReport
MGG495_MarketEntryPlanFinalReportMGG495_MarketEntryPlanFinalReport
MGG495_MarketEntryPlanFinalReport
 
Xerox toner dolumu adana 13 mart 2016
Xerox toner dolumu adana 13 mart 2016Xerox toner dolumu adana 13 mart 2016
Xerox toner dolumu adana 13 mart 2016
 
APRICOT 2012 - Living with the ever-growing BGP table: an OCN story
APRICOT 2012 - Living with the ever-growing BGP table: an OCN storyAPRICOT 2012 - Living with the ever-growing BGP table: an OCN story
APRICOT 2012 - Living with the ever-growing BGP table: an OCN story
 
Recent Network Trends in Asia and Oceania
Recent Network Trends in Asia and OceaniaRecent Network Trends in Asia and Oceania
Recent Network Trends in Asia and Oceania
 
Network State Awareness & Troubleshooting
Network State Awareness & TroubleshootingNetwork State Awareness & Troubleshooting
Network State Awareness & Troubleshooting
 
Learning objectives and goals
Learning objectives and goalsLearning objectives and goals
Learning objectives and goals
 
Adlt673 session 5_quantitative_validity_practicatility - class 5
Adlt673 session 5_quantitative_validity_practicatility - class 5Adlt673 session 5_quantitative_validity_practicatility - class 5
Adlt673 session 5_quantitative_validity_practicatility - class 5
 
SQL Windowing
SQL WindowingSQL Windowing
SQL Windowing
 
RDBMS x NoSQL
RDBMS x NoSQLRDBMS x NoSQL
RDBMS x NoSQL
 
New Market Evaluation Strategy Guide
New Market Evaluation Strategy GuideNew Market Evaluation Strategy Guide
New Market Evaluation Strategy Guide
 
Classroom Assessment - Unit A2
Classroom Assessment - Unit A2Classroom Assessment - Unit A2
Classroom Assessment - Unit A2
 
Martha septiningtyas second language acqusition
Martha septiningtyas second language acqusition Martha septiningtyas second language acqusition
Martha septiningtyas second language acqusition
 
Splunk
SplunkSplunk
Splunk
 
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...
XO Communications has the Largest Installed Base of SIP Connectivity Trunks i...
 
Xie X et al 2014
Xie X et al 2014Xie X et al 2014
Xie X et al 2014
 
approaches to curriculum design
approaches to curriculum designapproaches to curriculum design
approaches to curriculum design
 

Semelhante a XML Data Types in the Real World

U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersMichael Rys
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL ServerEduardo Castro
 
Querying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuerying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuyVo27
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL ServerEduardo Castro
 
Enterprise geodatabase sql access and administration
Enterprise geodatabase sql access and administrationEnterprise geodatabase sql access and administration
Enterprise geodatabase sql access and administrationbrentpierce
 
Query editor for multi databases
Query editor for multi databasesQuery editor for multi databases
Query editor for multi databasesAarthi Raghavendra
 
SQL Server 2008 For Developers
SQL Server 2008 For DevelopersSQL Server 2008 For Developers
SQL Server 2008 For DevelopersJohn Sterrett
 
Presentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12cPresentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12cRonald Francisco Vargas Quesada
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And XmlDavid Truxall
 
World2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewWorld2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewFarah Omer
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 Richie Rump
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Michael Rys
 
Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLEDrkhanchanaR
 
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)Alexandre Rafalovitch
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptxKulbir4
 

Semelhante a XML Data Types in the Real World (20)

U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL Server
 
Sql Server2008
Sql Server2008Sql Server2008
Sql Server2008
 
Querying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuerying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptx
 
Spatial Data in SQL Server
Spatial Data in SQL ServerSpatial Data in SQL Server
Spatial Data in SQL Server
 
Enterprise geodatabase sql access and administration
Enterprise geodatabase sql access and administrationEnterprise geodatabase sql access and administration
Enterprise geodatabase sql access and administration
 
Ssn0020 ssis 2012 for beginners
Ssn0020   ssis 2012 for beginnersSsn0020   ssis 2012 for beginners
Ssn0020 ssis 2012 for beginners
 
Query editor for multi databases
Query editor for multi databasesQuery editor for multi databases
Query editor for multi databases
 
SQL Server 2008 For Developers
SQL Server 2008 For DevelopersSQL Server 2008 For Developers
SQL Server 2008 For Developers
 
Rdbms
RdbmsRdbms
Rdbms
 
Using T-SQL
Using T-SQL Using T-SQL
Using T-SQL
 
Presentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12cPresentación Oracle Database Migración consideraciones 10g/11g/12c
Presentación Oracle Database Migración consideraciones 10g/11g/12c
 
Xml
XmlXml
Xml
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
World2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewWorld2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverview
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)
 
Unit I Database concepts - RDBMS & ORACLE
Unit I  Database concepts - RDBMS & ORACLEUnit I  Database concepts - RDBMS & ORACLE
Unit I Database concepts - RDBMS & ORACLE
 
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)
Rebuilding Solr 6 examples - layer by layer (LuceneSolrRevolution 2016)
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

XML Data Types in the Real World

  • 1. XML Data Type Methods In the Real World Steve Hughes Senior Data Architect, XATA Corporation
  • 2. Agenda • Overview of XML in SQL Server 2005 • A Case for Using XML in SQL Server • Brief Introduction to the XML Data Type • XML Data Type Methods with Demos • Lessons Learned AD-307 • XML Data Type Methods in the Real World
  • 3. Overview of XML in SQL Server 2005 • XML Data Type • XML Data Type Methods • XML Schema Collections • XQuery • This allows direct support of XQuery in the .NET Framework • OPENXML and FOR XML • Various improvements in SQL Server 2005 • OPENROWSET • Used for bulk operation and was improved in SQL Server 2005 as well AD-307 • XML Data Type Methods in the Real World
  • 4. A Case for Using XML in SQL Server • Implementing Multidimensional Arrays • Relating multiple unrelated types of data • Service Broker implementation • Extracting XML messages from the broker in the activation stored procedure or procedures called by the activation stored procedure • Use in place of comma separated lists • Common implementation when sending parameters with multiple values AD-307 • XML Data Type Methods in the Real World
  • 5. Introducing XML Data Type Methods • XML Data Type Methods work against the SQL Server XML data type within SQL • They work with typed and untyped XML • They work with XML Variables and Columns • These methods extract or manipulate XML data • Uses XQuery syntax • Methods • query • value • exist • modify • nodes AD-307 • XML Data Type Methods in the Real World
  • 6. Query() • Description • Allows you to select data out of the XML data type variable or column • Returns XML • Syntax • query(‘XQuery’) • Demo AD-307 • XML Data Type Methods in the Real World
  • 7. Value() • Description • Use this method to query for a scalar value out of the XML • It returns most SQL Data Types, the exceptions are: • xml • image • text • ntext • sql_variant • Syntax • value(‘XQuery’, ‘SQL Data Type’) • Demo AD-307 • XML Data Type Methods in the Real World
  • 8. Exist() • Description • Works similar to the EXISTS statement in T-SQL • Returns 1 if the XQuery returns a result • Syntax • exist(‘XQuery’) • Demo AD-307 • XML Data Type Methods in the Real World
  • 9. Modify() • Description • This method modifies the content of the xml document • It can insert, delete and replace values • This method can only be used in the SET clause of an UPDATE statement • This method uses XML Data Manipulation Language (DML) to modify the document • Syntax • modify(‘XML_DML’) • Demos • insert • delete • replace value of AD-307 • XML Data Type Methods in the Real World
  • 10. Nodes() • Description • This method is used to shred XML data into relational data • This method returns the data as rowset that can be used like a table in T-SQL. • Syntax • nodes(‘XQuery’) as Table(Column) • Demo AD-307 • XML Data Type Methods in the Real World
  • 11. Using the CROSS APPLY operator • The APPLY operator allows you to apply a table function to a rowset and return the values as a single result set of both sets of data • CROSS APPLY returns the matching records • Used with the nodes() method and a XML Data Type column, you can return shredded XML data with the relational data from the same table • Demo AD-307 • XML Data Type Methods in the Real World
  • 12. Demonstration Real world implementations • Parameter for a Stored Procedure • Used to interpret messages from Service Broker AD-307 • XML Data Type Methods in the Real World
  • 13. Lessons Learned • Setting options SET Options Required Values that must be ANSI_NULLS ON applied ANSI_PADDING ON • Always work with ANSI_WARNINGS ON ARITHABORT ON the developers on CONCAT_NULL_YIELD_NULL ON the XML syntax NUMERIC_ROUNDABORT OFF • If you have not QUOTED_IDENTIFIER ON used XML much, there is a learning curve, be sure to account for it. • It can be difficult to tune queries with XML methods AD-307 • XML Data Type Methods in the Real World
  • 14. Tuning and Performance • Caveat: This is related to using XML data type for passing parameters • Memory pressure was expected, but not present • CPU can be heavily utilized for large parsing operations • Execution plan shows a Table Valued Function for each method you use • Indexes can only be used if the data in the table • Using schemas will usually hurt performance in this scenario as it adds another layer of work for the parser • Couple of Performance demos Session Code • Session Title
  • 15. Q&A AD-307 • XML Data Type Methods in the Real World
  • 16. Additional Resources • SQL Server 2005 Books Online • Search for XML Data Type • MSDN.microsoft.com • Performance Optimizations for the XML Data Type in SQL Server 2005 http://msdn2.microsoft.com/en-us/library/ms345118.aspx • http://blogs.msdn.com/spal/default.aspx • Using XML Data Type Methods to query SSIS Packages • http://sqlblog.com/blogs/peter_debetta/archive/2006/07/13/Using _XML_Data_Type_Methods_to_query_SSIS_Packages.aspx • Michael Rys’s blog – Musings on XML, XQuery and more – He has links to multiple related whitepapers • http://sqljunkies.com/weblog/mrys/ AD-307 • XML Data Type Methods in the Real World
  • 17. Thank you! Thank you for attending this session and the 2007 PASS Community Summit in Denver AD-307 • XML Data Type Methods in the Real World

Notas do Editor

  1. Store Aisle with Groceries The aisle never changes The groceries are stored in the XML column Request is to see what aisle each grocery type is in CROSS APPLY allows us to break ou the