T-SQL passer une vue en variable
Bonjour,
je dois générer des fichiers XML, et cette génération s'appuie sur plusieurs vues.
est-ce possible de déclarer une variable qui appelle une vue ?
ou est-ce une aberration de coder comme ça ?
quelque chose du genre :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
DECLARE @ENVIRONNEMENT char;
DECLARE @XMLPART XML;
SELECT @XMLPART = (select *
from (
(select
InstrId "CdtTrfTxInf/PmtId/InstrId"
,EndToEndId "CdtTrfTxInf/PmtId/EndToEndId"
,'EUR' as "CdtTrfTxInf/Amt/InstdAmt/@Ccy"
,Cast ( InstdAmt as decimal(18,2) ) as "CdtTrfTxInf/Amt/InstdAmt"
,dbo.RemoveNonASCII(nm) as "CdtTrfTxInf/Cdtr/Nm"
,upper(IBAN) as "CdtTrfTxInf/CdtrAcct/Id/IBAN"
,Ustrd "CdtTrfTxInf/RmtInf/Ustrd"
FROM @ENVIRONNEMENT
where [Numéro de prise en compte] in (@LOT)
)) X for xml path(''), type |