Align = in MERGE statement
RichardMGreen
Posts: 24 Bronze 1
in SQL Prompt
Hi all
We've been using SQL Prompt styles to give our code a standardised format but there's one small niggle.
We can align the "=" in the FROM clause on joins but, when using an MERGE statement, we can't find the option to align the "=" in the "WHEN MATCHED" section.
Does anyone have any pointers on this?
Thanks
Richard
We've been using SQL Prompt styles to give our code a standardised format but there's one small niggle.
We can align the "=" in the FROM clause on joins but, when using an MERGE statement, we can't find the option to align the "=" in the "WHEN MATCHED" section.
Does anyone have any pointers on this?
Thanks
Richard
Tagged:
Answers
Thanks for posting on the Redgate forums.
It might be that this is a feature request, but to confirm could you please show a before and after code sample of what you are expecting to see?
Dan Bainbridge
Product Support Engineer | Redgate Software
This is what we currently get:-
WHEN MATCHED THEN
UPDATE
SET
TARGET.fkPatientLocalID= SOURCE.PatientLocalID
,TARGET.fkStaffLocalID= SOURCE.StaffLocalID
,TARGET.EpisodeStartDateTime= SOURCE.EpisodeStartDateTime
,TARGET.EpisodeEndDateTime= SOURCE.EpisodeEndDateTime
,TARGET.MainSpecialtyLocalCode= SOURCE.MainSpecialtyLocalCode
,TARGET.MainSpecialtyLocalDescription= SOURCE.MainSpecialtyLocalDescription
,TARGET.MainSpecialtyNationalCode= SOURCE.MainSpecialtyNationalCode
,TARGET.MainSpecialtyNationalDescription= SOURCE.MainSpecialtyNationalDescription
,TARGET.TreatmentFunctionLocalCode= SOURCE.TreatmentFunctionLocalCode
,TARGET.TreatmentFunctionLocalDescription= SOURCE.TreatmentFunctionLocalDescription
,TARGET.TreatmentFunctionNationalCode= SOURCE.TreatmentFunctionNationalCode
,TARGET.TreatmentFunctionNationalDescription= SOURCE.TreatmentFunctionNationalDescription
,TARGET.IsDeleted= SOURCE.IsDeleted
,TARGET.SYSDateLastUpdated= @Today
This is what we'd like to see:-
WHEN MATCHED THEN
UPDATE
SET
TARGET.fkPatientLocalID = SOURCE.PatientLocalID
,TARGET.fkStaffLocalID = SOURCE.StaffLocalID
,TARGET.EpisodeStartDateTime = SOURCE.EpisodeStartDateTime
,TARGET.EpisodeEndDateTime = SOURCE.EpisodeEndDateTime
,TARGET.MainSpecialtyLocalCode = SOURCE.MainSpecialtyLocalCode
,TARGET.MainSpecialtyLocalDescription = SOURCE.MainSpecialtyLocalDescription
,TARGET.MainSpecialtyNationalCode = SOURCE.MainSpecialtyNationalCode
,TARGET.MainSpecialtyNationalDescription = SOURCE.MainSpecialtyNationalDescription
,TARGET.TreatmentFunctionLocalCode = SOURCE.TreatmentFunctionLocalCode
,TARGET.TreatmentFunctionLocalDescription = SOURCE.TreatmentFunctionLocalDescription
,TARGET.TreatmentFunctionNationalCode = SOURCE.TreatmentFunctionNationalCode
,TARGET.TreatmentFunctionNationalDescription = SOURCE.TreatmentFunctionNationalDescription
,TARGET.IsDeleted = SOURCE.IsDeleted
,TARGET.SYSDateLastUpdated = @Today
Hopefully the above makes sense.
If not, I can post screenshots if that is an option.
Thanks
Richard
Hi Dan
Found the option to attach a screenshot.
This is what we'd like to see.
Thanks
Richard
Dan Bainbridge
Product Support Engineer | Redgate Software
Thanks Dan.
Is there any way for me to help this gain some momentum?
Regards
Richard