By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE OR ALTER PROCEDURE Report_Statement
@EndDate SMALLDATETIME = NULL
,@OfficeFilterBy INT = NULL
,@DepartmentFilterBy INT = NULL
,@companyFilterBy INT = NULL
,@CustomerIdFilterBy INT = NULL
AS
DECLARE @myXmlStr nvarchar(max) = (
SELECT
1 AS [Params/@ID],
@EndDate AS [Params/@Date],
@OfficeFilterBy AS [Office/@KeyId],
@DepartmentFilterBy AS [Department/@KeyId],
@companyFilterBy AS [company/@KeyId],
@CustomerIdFilterBy AS [Customer/@KeyId]
FOR XML PATH(''), ROOT('XML')
);
SELECT @myXmlStr;
EXEC Report_Statement
@EndDate='2022-07-05T00:00:00',
@CustomerIdFilterBy=19,
@companyFilterBy=1,
@DepartmentFilterBy=1,
@OfficeFilterBy=1;
(No column name) |
---|
<XML><Params ID="1" Date="2022-07-05T00:00:00"/><Office KeyId="1"/><Department KeyId="1"/><company KeyId="1"/><Customer KeyId="19"/></XML> |