How can we help you today? How can we help you today?

cte formatting fails

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;
torsten.strauss
0

Comments

4 comments

  • David Priddle
    Hi Torsten,

    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
    David Priddle
    0
  • torsten.strauss
    Hi David!

    Sent! Happy debugging!

    Torsten
    torsten.strauss
    0
  • David Priddle
    Thanks for the style Torsten,

    We can reproduce this here and should have a fix in the next release.

    Best regards,

    David
    David Priddle
    0
  • David Priddle
    Hi Torsten,

    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
    David Priddle
    0

Add comment

Please sign in to leave a comment.