SQL'den bir XML çıktısı oluşturmaya çalışıyorum ve bir UNION deyimi kullanmam ve aynı zamanda çıktı sütununu adlandırmam gerekiyor.SQL UNION FOR XML ad çıktı sütunu
ben kullanarak bir UNION deyimi kullanmaya gerek yoktu ne zaman önce bu çalışma vardı: XmlOutput olarak çıktı XML sütun adında
select(
SELECT
[CompanyName],
[Address1],
[Address2],
[Address3],
[Town],
[County],
[Postcode],
[Tel],
[Fax],
[Email],
[LocMap]
FROM [UserAccs] FOR XML PATH ('AccountDetails'), root ('Root')
) as XmlOutput
şimdi çalışıyorum
:
select(
SELECT
[CompanyName],
[Address1],
[Address2],
[Address3],
[Town],
[County],
[Postcode],
[Tel],
[Fax],
[Email],
[LocMap]
FROM [UserAccs]
UNION
SELECT
[CompanyName],
[Address1],
[Address2],
[Address3],
[Town],
[County],
[Postcode],
[Tel],
[Fax],
[Email],
[LocMap]
FROM [UserAppAccs]
FOR XML PATH ('AccountDetails'), root ('Root')
) as XmlOutput
Ancak bir hata mesajı alıp, bunun bir yolu bilen var mı?
The FOR XML clause is invalid in views, inline functions, derived tables, and subqueries when they contain a set operator. To work around, wrap the SELECT containing a set operator using derived table syntax and apply FOR XML on top of it.
Teşekkür J.
hata mesajı ne diyor? – Mithrandir
Yukarıdaki hata mesajı ... teşekkürler – JBoom