Last post Jul 29, 2019 01:58 PM by limno
Jul 29, 2019 09:59 AMfirstname.lastname@example.org|LINK
i have a stored procedure, there im retrieving date of birth, this should not visible to all users so, i have to dislay ***** symbols in DOB column to non permitted users, i have query written like below
DECLARE @GdprMask CHAR(25) = '********************' ;
select office ,
case when Exists (select 'x' from dbo.uvw_GdprDOB where employeeID = @UserID) then DOB else cast(@GdprMask as Datetime) end DOB,
but, while executing this query im getting below error, may i know how to achieve this goal!!
Conversion failed when converting date and/or time from character string.
Jul 29, 2019 11:04 AMemail@example.com|LINK
i found the solution
case when Exists (select 'x' from dbo.uvw_GdprDOB where employeeID = @UserID) then
cast(DOB as char(20)) else @GdprMask end DOB,
Jul 29, 2019 01:58 PM|limno|LINK
For newer SQL Server (2016 or above), you can try the Dynamic Data Masking to hide information for different users.