Forum Discussion
Is it possible to restrict SQL query result visibility by column data using RLS?
Not quite sure it qualifies as on the fly, since I do need it to consistently do the same thing. I need five roles, each of them only being able to view rows if the row's access level is equal to or lower than theirs.
As far as data, just assume a SQL Server table with columns Inv_Number, Description, Date, and Access Level. Access level is an integer ranging from 1-5, and my query returns all records from this table - I just need to be able to ensure that each user has a role assigned to them to prevent them from viewing rows that exceed their access level.
- v-deddai1-msft5 years ago
Community Support
Hi MNollette ,
You could create 5 roles based on your sample:
[Access level] <=1 [Access level] <=2 [Access level] <=3 [Access level] <=4 [Access level] <=5If this post help, please consider accept it as the solution to help other member find it more quickly.
Best Regards,
Dedmon Dai