cte formatting fails
torsten.strauss
Posts: 269 Silver 3
Hi !
The formatting on the following statement fails despite of the fact that parsing and executing is fine.
/*
Author: strat8
Create date: 2016-11-09
Revision History: yyyy-mm-dd Revisor
DescriptionOfChanges
Description: populate the ist.cvp_stage dimension
*/
SET NOCOUNT ON;
SET XACT_ABORT ON;
BEGIN TRY
BEGIN TRAN;
WITH cte
AS (
SELECT
ID_cvp_stage,cvp_stage
FROM
(
VALUES
( 1,'Appraise' )
, ( 2,'Select' )
, ( 3,'Define' )
, ( 4,'Execute' )
, ( 5,'Operate' )
)
AS cvp_stageTableName ( ID_cvp_stage, cvp_stage )
)
MERGE list.cvp_stage WITH ( SERIALIZABLE ) tar
USING cte sou
ON
tar.ID_cvp_stage = sou.ID_cvp_stage
WHEN NOT MATCHED BY TARGET THEN
INSERT
(
ID_cvp_stage, cvp_stage
)
VALUES (
sou.ID_cvp_stage
, sou.cvp_stage
) ;
COMMIT TRAN;
RETURN;
END TRY
BEGIN CATCH
@TRANCOUNT > 0
AND XACT_STATE() <> 0
ROLLBACK TRAN;
THROW;
END CATCH;
The formatting on the following statement fails despite of the fact that parsing and executing is fine.
/*
Author: strat8
Create date: 2016-11-09
Revision History: yyyy-mm-dd Revisor
DescriptionOfChanges
Description: populate the ist.cvp_stage dimension
*/
SET NOCOUNT ON;
SET XACT_ABORT ON;
BEGIN TRY
BEGIN TRAN;
WITH cte
AS (
SELECT
ID_cvp_stage,cvp_stage
FROM
(
VALUES
( 1,'Appraise' )
, ( 2,'Select' )
, ( 3,'Define' )
, ( 4,'Execute' )
, ( 5,'Operate' )
)
AS cvp_stageTableName ( ID_cvp_stage, cvp_stage )
)
MERGE list.cvp_stage WITH ( SERIALIZABLE ) tar
USING cte sou
ON
tar.ID_cvp_stage = sou.ID_cvp_stage
WHEN NOT MATCHED BY TARGET THEN
INSERT
(
ID_cvp_stage, cvp_stage
)
VALUES (
sou.ID_cvp_stage
, sou.cvp_stage
) ;
COMMIT TRAN;
RETURN;
END TRY
BEGIN CATCH
@TRANCOUNT > 0
AND XACT_STATE() <> 0
ROLLBACK TRAN;
THROW;
END CATCH;
Comments
Unfortunately I'm unable to reproduce this problem. Would you be able to send us your style to sqlpromptteam@red-gate.com?
Best regards,
David
Sent! Happy debugging!
Torsten
We can reproduce this here and should have a fix in the next release.
Best regards,
David
We have a fix in the latest release that should solve this issue.
Could you let us know if this fixes it?
Best regards,
David