1
說我有一個這樣的查詢蒙上XML查詢在連接查詢在SQL服務器使用鑄造列名
SELECT TOP 5
CAST (row.query('col(/xml/tag)'), as NVARCHAR(100)) AS 'foobar'
FROM db.table
如何使用在LEFT JOIN
XML查詢的鑄造結果?
SELECT TOP 5
CAST (row.query('col(/xml/tag)'), as NVARCHAR(100)) AS 'foobar'
FROM db.table
LEFT JOIN db.table_table
-- don't know the syntax for this part
ON db.table['foobar'] = db.table_table.col
這需要[動態SQL](https://msdn.microsoft.com/en-us/library/ms188001.aspx) – JohnHC
@JohnHC感謝對於文檔,欣賞它 –