0
CREATE SECURITY POLICY Security_Policy 
ADD FILTER PREDICATE RLS.fn_CanSeeSalary(EmployeeName) 
ON dbo.Salary 
WITH (STATE = ON); 

When I execute the query above I get the following error:

Msg 343, Level 15, State 1, Line 37
Unknown object type 'SECURITY' used in a CREATE, DROP, or ALTER statement.
Msg 102, Level 15, State 1, Line 38
Incorrect syntax near 'FILTER'.

Bogdan Sahlean
  • 19,233
  • 3
  • 42
  • 57
MeBy2
  • 21
  • 9
  • CREATE SECURITY POLICY Security_Policy ADD FILTER PREDICATE RLS.fn_CanSeeSalary(EmployeeName) ON dbo.Salary WITH (STATE = ON); – MeBy2 Jun 30 '17 at 07:09
  • yes bogdan sahlean – MeBy2 Jun 30 '17 at 07:16
  • 1
    What's your SQL Version ? RLS is only available in SQL Server V12 and also SQL Server 2016 CTP – Prabhat G Jun 30 '17 at 07:17
  • What is the output of `SELECT @@VERSION` ? – Bogdan Sahlean Jun 30 '17 at 07:20
  • Microsoft SQL Server 2014 (SP2-GDR) (KB3194714) - 12.0.5203.0 (X64) Sep 23 2016 18:13:56 Copyright (c) Microsoft Corporation Enterprise Evaluation Edition (64-bit) on Windows NT 6.3 (Build 15063: ) (Hypervisor) – MeBy2 Jun 30 '17 at 07:21
  • You need SQL Server 2016 for this to work. Since you have Evaluation Edition, I don't think upgrading it to the latest version will cause any troubles. – Roger Wolf Jun 30 '17 at 07:44
  • unable to connect sql server 2016 after installation,can't find the server instance name or the configuration file during the installation – MeBy2 Jun 30 '17 at 10:26

1 Answers1

0
CREATE SECURITY POLICY Security_Policy
ADD FILTER PREDICATE RLS.fn_CanSeeSalary([EmployeeName]) 
ON dbo.Trn_AccDet
Peter Hall
  • 53,120
  • 14
  • 139
  • 204
Alfaiz Ahmed
  • 1,698
  • 1
  • 11
  • 17
  • same error, Msg 343, Level 15, State 1, Line 44 Unknown object type 'SECURITY' used in a CREATE, DROP, or ALTER statement. Msg 102, Level 15, State 1, Line 44 Incorrect syntax near 'FILTER'. – MeBy2 Jun 30 '17 at 07:24