I’ve found that I had added Sensitivity Classification to all my Temporal Tables, (and only to some of my non-Temporal Tables).
As in
add SENSITIVITY CLASSIFICATION to dbo.Mytable.name with (LABEL = 'General', INFORMATION_TYPE = 'Public')
when I drop the Sensitivity Classification, the old error message is back.
I have an example that demonstrates the error:
drop table if exists dbo.mytable
go
create table dbo.Mytable (i int not null identity(1,1) primary key clustered, name varchar(10) not null)
go
insert into dbo.Mytable ( name ) values ( 'abc' )
go
select * from dbo.Mytable where name = 1 -- programming error; data type mis-match
returns
(1 row affected)
Msg 245, Level 16, State 1, Line 8
Conversion failed when converting the varchar value 'abc' to data type int.
This is the correct error message. Now run this:
add SENSITIVITY CLASSIFICATION to dbo.Mytable.name with (LABEL = 'General', INFORMATION_TYPE = 'Public')
and when you run this
select * from dbo.Mytable where name = 1 -- programming error; data type mis-match
You will see this
Msg 245, Level 16, State 1, Line 169
Conversion failed when converting the ****** value '******' to data type ******.
This is the in-correct error message.
I've tried this code on Azure SQL Database where I get the in-correct message, and on SQL Server 2019 CU6, where I only get the correct message.
I have reported this to Microsoft, and first-level support hasthey have acknowledged that this looks weirdis a bug, and that they will pass it on to their second-level supportwill be fixed in a few months.
I have created two scripts to 1) document existing classifications, and 2) drop all those classifications.
The scripts can be found here: document and drop classifications