Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Atributo xml de consulta do SQL Server para um valor de elemento

;WITH XMLNAMESPACES(DEFAULT N'http://www.kaseya.com/vsa/2007/12/ServiceDeskDefinition.xsd')
select
    T.C.value('data(.)', 'nvarchar(128)')
from [YOUR_TABLE] as Y
    outer apply Y.[YOUR_XML_COLUMN].nodes('/CustomFields/Field[@fieldName="CwTicketId"]') as T(C)