MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value:
SELECT col1
FROM table1
WHERE col2 = \'x\'
ORDER by col
stored procedure
declare @requestResultXML xml
set @requestResultXML =
(
SELECT 'NPOIT-1.0' AS '@Interface',
(
select 'Query' as '@Type',
'GetBill' as '@Query',
'True' as '@CompressResult'
FOR XML PATH('Head'), TYPE
),
(
select @pin as '@PIN',
@period as '@Period',
@number as '@Number',
@barcode as '@Barcode'
FOR XML PATH('QueryParams'), TYPE
) as Data
FOR XML PATH('DataExchangeModule')
)
select @requestResultXML as GetBillRequest