Sqlserver Developer 2021 May 2026

CREATE FUNCTION dbo.fn_SecurityPredicate(@SalesRep AS sysname) RETURNS TABLE WITH SCHEMABINDING AS RETURN SELECT 1 AS is_valid WHERE @SalesRep = USER_NAME() OR USER_NAME() = 'Manager'; CREATE SECURITY POLICY SalesFilter ADD FILTER PREDICATE dbo.fn_SecurityPredicate(SalesRep) ON dbo.Sales; Hide data from non-privileged users without changing app code.

Happy coding. May your seeks be narrow and your scans be none. About the author: 15+ years of SQL Server experience across financial, retail, and logistics sectors. Microsoft Data Platform MVP. sqlserver developer

: