how t checkk pii column in db

 EXEC sp_msforeachDB 'USE [sn_baxter]

SELECT db_name() as [DB], 

object_name(o.object_id) AS [Object], 

c.name AS [Column]

FROM sys.columns c join sys.objects o ON c.object_id = o.object_id 

WHERE o.type IN (''U'',''V'') /* tables and views */

AND (c.name like ''%mail%''

OR c.name like ''%first%name%''

OR c.name like ''%last%name%''

OR c.name like ''%birth%''

OR c.name like ''%sex%''

OR c.name like ''%address%''

OR c.name like ''%phone%''

OR c.name like ''%social%''

OR c.name like ''%ssn%''

OR c.name like ''%gender%'')

AND db_name() NOT IN (''msdb'',''tempdb'',''master'')'

Comments

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

java practice set 8

new stored procidure with interval and frequery code