sql-server-maintenance-solution icon indicating copy to clipboard operation
sql-server-maintenance-solution copied to clipboard

DBCC check fails due to case difference in server name on CS collation server

Open Pineapple-lumps opened this issue 2 years ago • 3 comments

Description of the issue A DBCC check fails when the server is using a case sensitive collation. This is because the @@servername is in lowercase, whereas SERVERPROPERTY('ServerName') is in upper case.

SQL Server version and edition Microsoft SQL Server 2019 (RTM-CU18-GDR) (KB5021124) - 15.0.4280.7 (X64)

Version of the script Version: 2022-12-03 17:23:44

What command are you executing? [dbo].[DatabaseIntegrityCheck]

What output are you getting? Msg 50000, Sev 16, State 1, Line 1017 : The @@SERVERNAME does not match SERVERPROPERTY('ServerName').

Pineapple-lumps avatar Feb 16 '23 02:02 Pineapple-lumps

It's been like this for long. One solution could be to LOWER( ) both values...but sql_variant...

The workaround I'm using is to create and run OH skripts in a DBMaint database that is CI_AS. A better approach than running it in master. Keep master clean and small.

ghost avatar Feb 16 '23 15:02 ghost

Thanks IverJoc. I'd modified the SP to use UPPER on both values. Which essentially does the same thing.

Good tip about changing the db collation. I assume you haven't noticed any collation conflicts?

Pineapple-lumps avatar Feb 16 '23 22:02 Pineapple-lumps

Hi, did UPPER work without any issues? That's good. I haven't experienced any other collation related conflict. The problem is Case sensitive.

Stiffboard avatar Feb 21 '23 07:02 Stiffboard