There is a specific user who is the job's owner in SQL Server. I want to limit his access to the database.
I searched the web and find the script fit my situation at SQL Server: can you limit access to only one table. I test the script to deny access to all tables, so the job should fail if the user cannot access the tables. However the job still runs without problem.
These are the steps I did to create the user and deny access to all tables:
- Created the user and its schema owner is dbo in master
- Create the user in the database
- Run the below script to deny access to the table for the user
There is my code:
USE [dtTest]
GO
EXEC sp_msforeachtable "DENY SELECT ON ? TO [tester];"
GO
Would someone tell me what I should do? Thanks in advance