0
目前我使用此查詢,得到的結果:與輸入參數查詢XML
Select *
From Staff
Where StaInsurance.exist('/COLInsuranceCompany/DOInsuranceCompany[Name/text()[. = "Apollo Life Assurance"]]') = 1
我怎樣才能在查詢中使用的輸入參數,而不是硬編碼字符串,下面沒有工作:
declare @IInsurance nvarchar(200)
set @IInsurance = 'Apollo Life Assurance'
Select *
From Staff
Where StaInsurance.exist('(/COLInsuranceCompany/DOInsuranceCompany/Name[id=(sql:variable("@IInsurance"))])[1]') = 1
添加xml爲例 – Backs