This month's discount Comprehensive Database Performance Health Check · Testimonials
SQLAuthority with Pinal Dave
Home
  • Consulting
    • Health Check
  • Free Videos
  • All Articles
    • AI
    • SQL Performance
    • SQL Tips and Tricks
    • Interview Questions and Answers
    • SQL Puzzle
    • SQL Video
    • SQLAuthority News
    • Personal
  • Books
  • Consulting
Several small plain brass locks beside one larger plain lock on a warm wooden tabletop.

What Lock Escalation Is and How to Stop It

September 1, 2011
Pinal Dave
SQL Performance
Best Practices, SQL Index, SQL Performance, SQL Server

Understand lock escalation, confirm it with evidence, and reduce its impact through smaller transactions, better access paths, and modern locking.

Read More
A query with PATH Item, ROOT Catalog, Price as an attribute and SeedName as text, beside the XML it returns: a Catalog root with four Item elements, each holding a Price attribute and a seed name

XML Element Names in SQL Server: Row, Root and Text With FOR XML PATH

September 1, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL String, SQL XML

XML element names in SQL Server come from your query, and FOR XML PATH lets you choose them. This post sets the row and root names, turns a column into an attribute, writes text inside an element and shows the error you get when an attribute column comes too late. Every result comes from SQL Server 2025.

Read More
Seven books on three shelves as XML: ordered by BookID the Shelf element repeats seven times, with Gardening, Travel and Cooking coming back again and again, while ordered by Section and Title there are only three Shelf elements holding two or three books each

FOR XML AUTO in SQL Server: Nest Joined Rows and Name the Root

August 31, 2011
Pinal Dave
SQL Tips and Tricks
SQL Joins, SQL Scripts, SQL Server, SQL XML

FOR XML AUTO turns a join into nested XML, with one element per table. This post shows where the element names come from, why row order decides the grouping, how ROOT adds a single root, and how the order of your columns flips the nesting. Every result comes from SQL Server 2025.

Read More
One borrower whose BranchID is NULL shown three ways: RAW writes three attributes and no BranchID, RAW with ELEMENTS writes three child elements, and ELEMENTS XSINIL writes four with BranchID marked xsi:nil true

FOR XML RAW in SQL Server: Row Names, ROOT, ELEMENTS and NULLs

August 30, 2011
Pinal Dave
SQL Tips and Tricks
SQL NULL, SQL Scripts, SQL Server, SQL XML

FOR XML RAW turns each row of a query into an XML element. This post names the row element, adds a ROOT, switches to ELEMENTS and shows how a NULL value drops out of the output until XSINIL puts it back. Every result comes from SQL Server 2025.

Read More
A cord passes through one reinforced brass opening in an intact canvas panel

EXECUTE AS OWNER in Stored Procedures: Power and Pitfalls

August 29, 2011
Pinal Dave
SQL Tips and Tricks
SQL Scripts, SQL Server, SQL Server Security

A procedure with owner rights can write to tables its caller cannot touch. Watch the identity change, and see how one careless parameter hands out too much.

Read More
A grid of four plants with its column names in one red header, beside the same rows as XML where PlantID, PlantName, Light and WaterDays repeat inside every row element

What Is XML in SQL Server: Tags, Attributes and Well-Formed Rules

August 29, 2011
Pinal Dave
SQL Tips and Tricks
SQL Datatype, SQL Scripts, SQL Server, SQL XML

What is XML in SQL Server? It’s plain text where every value carries its own label. This post turns four plant rows into XML with FOR XML RAW, names the parts of a document, and shows the errors SQL Server returns when a rule is broken.

Read More
A grid of two cases: when Plan A works the UPDATE runs, Plan A worked is printed and CATCH is skipped; when Plan A fails the UPDATE raises error 515, the rest of TRY is skipped and CATCH prints Plan B with error 515, severity 16, line 2

TRY CATCH Block in SQL Server: Plan A, Plan B and the Rollback

August 28, 2011
Pinal Dave
SQL Tips and Tricks
SQL Error Messages, SQL Scripts, SQL Server, SQL Transactions

A TRY CATCH block runs Plan A and falls back to Plan B when Plan A raises an error. This post shows that CATCH runs only after an error, that severity 11 is the line between a message and an error, and that one ROLLBACK undoes a nested transaction completely. Every result comes from SQL Server 2025.

Read More
Previous 1 … 308 309 310 311 312 313 314 … 416 Next
  • Books
  • Testimonials
  • Privacy Policy

© 2006 – 2026 All rights reserved. pinal @ SQLAuthority.com