New features added to SQL Prompt Watch now.

Is there an option in SQL Prompt Styles to format the Merge statements

Is there an option in SQL Prompt Styles to format the Merge statements like below:

From:

  MERGE dbo.TableName AS TARGET
  USING
    (
      SELECT
        @ScheduleId ScheduleId,
        @AgreementID AgreementID
    ) AS SOURCE
  ON (TARGET.ID = SOURCE.ScheduleId)
  WHEN MATCHED THEN UPDATE SET
                      TARGET.AgreementID = SOURCE.AgreementID,
                      TARGET.ScheduleName = SOURCE.ScheduleName
  WHEN NOT MATCHED BY TARGET THEN
    INSERT
      (
        AgreementID,
        ScheduleName
      )
    VALUES
      (
        SOURCE.AgreementID,
        SOURCE.ScheduleName
      );


TO:

  MERGE dbo.TableName AS TARGET
  USING
    (
      SELECT
        @ScheduleId ScheduleId,
        @AgreementID AgreementID
    ) AS SOURCE
  ON (TARGET.ID = SOURCE.ScheduleId)
  WHEN MATCHED
    THEN UPDATE SET
      TARGET.AgreementID = SOURCE.AgreementID,
      TARGET.ScheduleName = SOURCE.ScheduleName
  WHEN NOT MATCHED BY TARGET 
    THEN INSERT
      (
        AgreementID,
        ScheduleName
      )
    VALUES
      (
        SOURCE.AgreementID,
        SOURCE.ScheduleName
      );


Answers

Sign In or Register to comment.