Your SlideShare is downloading. ×
Sql2005 xml
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Sql2005 xml

293
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
293
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. XML Enables SQL Server to be a Complete Data PlatformExploit the XML Capabilities of SQL Server 2005 by Jason Follas
  • 2. Vanity
  • 3. Jason Follas
  • 4. Technical Architect
  • 5. User Group Leader
  • 6. Microsoft MVP – SQL Server
  • 7. Motorcycle Enthusiast
  • 8. 232,582,657-1
    Astronomy, Prime Numbers, Guitar
  • 9. Serious Addiction to the World of Warcraft
  • 10. Primer
  • 11. Before we begin, let’s establish a base level of knowledge
  • 12. demo
  • 13. XML Enables SQL Server to be a Complete Data PlatformExploit the XML Capabilities of SQL Server 2005 by Jason Follas
  • 14. Act I
  • 15. Today's data world is full of XML-based data sources
  • 16. <XML>
    Every database developer should be able to move data into and out of XML
    SQL
  • 17. XML translation in middle-tier can be inflexible and may even increase network overhead
  • 18. Move XML handling into the database to improve overall integration
  • 19. Utilize SQL Server 2005 for database solutions that need to use XML data
    <XML>
  • 20. Act II, Scene 1
  • 21. Interpret XML as More Than Just Text Using the XML Data Type
  • 22. XML is a First-Class Citizen data type
    INT
    DATETIME
    VARCHAR
    XML
  • 23. Used in columns, variables, parameters, and return types
  • 24. Serialize to and parse from string representation
  • 25. Full support for typed XML using Schema
  • 26. Has methods that offer inspection and extraction of data from the XML
  • 27. exist()
  • 28. query() and value()
  • 29. nodes()
  • 30. XML columns can be indexed for faster access to the contained data
  • 31. Primary XML Index
  • 32. Secondary XML Indexes (value, path, property)
  • 33. Examples of when a secondary should be considered
  • 34. demo
  • 35. Act II, Scene 2
  • 36. Harness the Data in XML Using the XQuery Language
  • 37. Path expressions
  • 38. Location steps
  • 39. Attributes
  • 40. Predicates
  • 41. FLWOR statement
    FORLETWHEREORDER BYRETURN
  • 42. For and Return
  • 43. Where
  • 44. Order By
  • 45. XQuery Functions
  • 46. Data Accessor Functions string() and data()
  • 47. Functions that act on data (numeric, string, context, aggregate functions)
  • 48. SQL Server Extension Functions sql:column() and sql:variable()
  • 49. demo
  • 50. Act II, Scene 3
  • 51. Create XML From Relational Data Using the FOR XML Clause
  • 52. Return XML from queries instead of rowsets
    <XML>
    SQL
  • 53. RAW Mode
    SELECT * FROM Employee FOR XML RAW('Employee')
    <Employee EmployeeID="2" Federal_ID="000-00-0001" Name="Andrew Miller" DOB="1968-05-01T00:00:00" StartDate="2000-01-01T00:00:00" ManagerFK="3" />
    <Employee EmployeeID="3" Federal_ID="000-00-0002" Name="Bert Parkins" DOB="1947-12-31T00:00:00" StartDate="2000-01-01T00:00:00" />
  • 54. AUTO Mode
    SELECT * FROM Employee FOR XML AUTO
    <Employee EmployeeID="2" Federal_ID="000-00-0001" Name="Andrew Miller" DOB="1968-05-01T00:00:00" StartDate="2000-01-01T00:00:00" ManagerFK="3" />
    <Employee EmployeeID="3" Federal_ID="000-00-0002" Name="Bert Parkins" DOB="1947-12-31T00:00:00" StartDate="2000-01-01T00:00:00" />
  • 55. Nested FOR XML Queries
    SELECT [EmployeeID],
    [Name],
    ( SELECT [EmployeeID],
    [Name]
    FROM [Employee]
    WHERE ManagerFK = E.EmployeeID
    FOR
    XML AUTO, TYPE
    ) DirectReports
    FROM [Employee] E
    FOR XML RAW('Employee')
    <Employee EmployeeID="2" Name="Andrew Miller">
    <DirectReports>
    <Employee EmployeeID="5" Name="Dave Murrel" />
    </DirectReports>
    </Employee>
    <Employee EmployeeID="3" Name="Bert Parkins">
    <DirectReports>
    <Employee EmployeeID="2" Name="Andrew Miller" />
    <Employee EmployeeID="4" Name="Brad Barnes" />
    </DirectReports>
    </Employee>
  • 56. Control the structure of the resulting XML
  • 57. PATH Mode
  • 58. TYPE Mode
  • 59. EXPLICIT Mode
  • 60. Add necessary complexity to the resulting XML
  • 61. NULL values and XSINIL
  • 62. Generate Schemas
  • 63. Adding Namespaces
  • 64. demo
  • 65. Does moving XML handling into the database improve overall design?
  • 66. Act III
  • 67. Developers unaware of SQL Server’s XML abilities are doing extra work
  • 68. Utilize SQL Server 2005 for database solutions that need to use XML data
    <XML>
  • 69. XML enables SQL Server to be a complete Data Platform
  • 70. XML and SQL Server – A Great Combination
  • 71. JASON FOLLAS
    http://jasonf-blog.blogspot.com
    (soon moving to)
    http://jasonfollas.com
    jason@jasonfollas.com

×