Does anyone know whether the XML or T-SQL count() functions are equivalent in execution, or is one more efficient than the other.
Is there any significant difference between...
SELECT
@max-2 = @x.query('
{ count(/Employees/Employee) }
').value('e[1]','int')
and
select @max-2 = count(*) from
@x.nodes('/Employees/Employee')
e(x)
?
The query plans indicate that the cost of the first is twice the cost of the second. Is this true in practice?
Derek