我想一個SELECT FOR XML顯式聲明的結果分配給一個XML變量如 CREATE PROCEDURE BILLING_RESPONSE
AS DECLARE @Data AS XML
SET @Data = (SELECT
1 AS Tag,
NULL AS Parent,
NULL AS 'CallTransactions!1!',
我正在使用SQL Server 2008,並試圖使用EXPLICIT模式與FOR XML生成自定義xml。 我也有一對多的關係,下面的查詢 select
p.personid, p.firstname, a.P_City
from
tblPeople p with (nolock)
left outer join
tblAddresses a with (nolo
我有這些表: TIPO X5_CHAVE X5_TABELA X5_DESCRI
-------- --------- ---------------------
04 02 APOIO DIDATICO
03 02 PESQUISA E REFERENCIA
GRUPO BM_GRUPO BM_DESC
-------- -----------
01 H
我試圖用FOR XML子句EXPLICIT模式查詢某個數據庫,但我不知道如何使用此模式指定XMLNAMESPACE和模式,就像使用WITH XMLNAMESPACE同時使用AUTO模式或RAW 此MSDN示例查詢,在其結果其指定Schema1作爲結果XML USE AdventureWorks2012;
GO
SELECT 1 as Tag,
0 as Parent,
SalesOrder
此查詢工作正常 SELECT 1 AS TAG, NULL AS parent, 1 [dog!1]
UNION (SELECT 1,NULL, 3)
FOR XML EXPLICIT, ROOT('dogs')
我想將它分配給一個變量。這不工會工作正常: DECLARE @x xml
SET @x = ((
(SELECT 1 AS TAG, NULL AS parent, 1