serverproperty('servername') output changed from 2019 RTM to CU18 and leads to backup error on case sensitive instances
It seems that starting with CU18 (?) for SQL Server 2019 the output of 'select serverproperty('servername')' is not longer in UPPER.
In 15.0.2000.5 the servername returned is in UPPER characters where in 15.0.4261.1 it returns the servername as configured in the OS in lower and UPPER. In not case sensitive instances this is not a problem but in case sensitives it is.
In the stored procedure [dbo].[DatabaseBackup] the line 2266 returns an error because @@Servername is always in UPPER and the comparison matches. IF @@SERVERNAME <> CAST(SERVERPROPERTY('ServerName') AS nvarchar(max)) AND SERVERPROPERTY('IsHadrEnabled') = 1
if I add an UPPER() it works fine. IF @@SERVERNAME <> UPPER(CAST(SERVERPROPERTY('ServerName') AS nvarchar(max))) AND SERVERPROPERTY('IsHadrEnabled') = 1
Maybe I missed something, but that's what I experienced...
Cheers Matt
I had a similar issue with Integrity checks. Same logic.
I changed mine to (covers both bases): IF UPPER(@@ServerName) <> UPPER(CAST(SERVERPROPERTY('ServerName') AS nvarchar(max))) AND SERVERPROPERTY('IsHadrEnabled') = 1
My @@servername was lower, and the SERVERPROPERTY servername was upper. Opposite of what you get.
Have logged a separate bug request, as it is in a different stored proc.
Steve