• ... and for a bonus answer. Because of the XML data structures/schemas I deal with I can get away with the lazy guy technique of "*:". This is not a Best practice though. The best practice would be to declare and reference the namespace like so:

    Using the sample data from my previous post...

    WITH XMLNAMESPACES ('Com.Commerce.Data/PaymentData.xsd' AS NS)

    SELECT *

    FROM dbo.tblOrder

    WHERE zPaymentData.exist('/NS:PaymentData/NS:CreditCardResult')=1;

    OR (my preference when declaring namespaces)...

    SELECT *

    FROM dbo.tblOrder

    WHERE zPaymentData.exist('declare namespace NS="Com.Commerce.Data/PaymentData.xsd"; /NS:PaymentData/NS:CreditCardResult')=1;

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001