Table of the five xml methods, what each returns and the result in this post: query() returns xml, value() returns an int you choose, exist() returns a bit, modify() changes the XML, and nodes() returns 5 rows from 2 documents

XML Data Type Methods in SQL Server: query, value, exist, modify and nodes

XML data type methods are the five functions you call on an xml column or variable: query(), value(), exist(), modify() and nodes(). Each gives back a different kind of answer: xml, a typed value, 1 or 0, a changed document or rows. This post runs all five on one small table of seeds, shows two common errors, and asks SQL Server what each method returns. Every result comes from SQL Server 2025.

Read More
Table of four ways to ask for the 10 Front tickets. A literal value gets an index seek with a key lookup and 32 reads. A variable with no hint gets a clustered index scan, an estimate of 25,005 rows and 1,435 reads. OPTIMIZE FOR and RECOMPILE both return to the seek and 32 reads

Query Hint Basics: Why a Variable Scans and OPTIMIZE FOR Seeks

Query hint basics start with one idea: a query hint is an instruction you add to one statement in the OPTION clause. This post builds a table of 50,010 tickets, shows a seek for a literal value, a scan for the same value in a variable, and a seek again with OPTIMIZE FOR and with RECOMPILE. It also shows what the hint costs when the value changes. Every number comes from SQL Server 2025.

Read More