Activity: Implementing RLS
In this section, we will look at how to implement RLS using our example of ToyStore Ltd. Mike has been asked to implement RLS so that every customer is able to view and edit only their records. The CustomerAdmin
user, however, should be allowed to view and edit all customer records. Follow these steps to complete the activity:
- Execute the following query to create the
dpl.Customers
table and populate it with sample records:CREATE TABLE Customers ( CustomerID int identity, Name sysname, CreditCardNumber varchar(100), Phone varchar(100), Email varchar(100) ) Go INSERT INTO Customers VALUES('Mike',0987654312345678,9876543210,'mike@ outlook.com'), ('Mike',0987654356784567,9876549870,'mike1@outlook. com'), ('Mike',0984567431234567,9876567210,'mike2@outlook.com'), (' john@dpl.com ',0987654312345678,9876246210,'john@outlook.com'), ('john@dpl.com ',0987654123784567,9876656870...