在 C# 中运行此 XML SQL 时发生错误。什么不见了?它在 SQL Server 管理工作室中运行良好,但在 c# 中运行良好。
protected DataTable ServiceCodes(string orderColumn = default(string), bool orderAscending = true)
{
string sql = @" SELECT DISTINCT(Split.a.value('.', 'VARCHAR(100)')) AS Data
FROM
(
SELECT CAST('<M>' + REPLACE(Text09, ',', '</M><M>') + '</M>' AS XML) AS Data
FROM Assets
WHERE Category = 'Service'
) AS A CROSS APPLY Data.nodes ('/M') AS Split(a) ORDER BY Data";
return DatabaseConnection.ExecuteDataTable(sql, 120000);
}