Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2018 February SQL Server Interview: Revoke all permissions, Grant one Table to User

SQL Server Interview: Revoke all permissions, Grant one Table to User

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

How to revoke all permissions of a user and grant only one table to that user in SQL Server?

If you are SQL DBA and planning for an interview, you should prepare for database security related interview questions.

I already published, please check the below link.

The Ultimate Page of the SQL Server Interview Questions & Answers for Database Administrators and Developers

As a SQL DBA, operating with database permissions is a routine work like giving permission to ad-hoc users and modifying whenever it is required.

Last year, I asked this question to a DBA, and I got an answer like “Remove the user and Create a new user with specific table permission.”
What do you think? Is this correct answer? – Partially Yes…

Before removing a user, you should verify the created objects by that user and create a new user with the same old name.

But without doing this all, the answer can be the below script:

Stop access to all tables for a user:

1
2
EXEC sp_msforeachtable "DENY ALL ON '?' TO [User_Name];"
GO

Grant specific table permission:

1
2
GRANT ALL ON [Schema_Name].[Table_Name] TO [User_Name]
GO

Feb 12, 2018Anvesh Patel

Please visit other related articles...

  • SQL Server Interview: How to remove New Line Character from a string?
  • SQL Server Interview: What is the difference between TABLOCK and TABLOCKX?
  • SQL Server Interview: Can we restore the only data file (.mdf file)?
  • SQL Server Interview: For Database Fresher – Different ways to create a Primary Key
  • SQL Server Interview: List out the Best Practices, after installation of SQL Server
  • SQL Server Interview: What is the difference between AUTO_UPDATE_STATISTICS and AUTO_UPDATE_STATISTICS_ASYNC
  • SQL Server Interview: What is the difference between Unique Constraint and Unique Index?
  • SQL Puzzle: SQL Advance Query – Find first 100 Prime numbers in SQL Server
SQL Server: Script to rename all Tables of a DatabaseSQL Server: How to change Authentication Mode from Windows Registry?
Anvesh Patel

Database Engineer

February 12, 2018 SQL Server, SQL Server InterviewAnvesh Patel, database, database research and development, dbrnd, GRANT, REVOKE, SQL Query, SQL Server, SQL Server Administrator, SQL Server Error, SQL Server Interview, SQL Server Monitoring, SQL Server Performance Tuning, SQL Server Programming, SQL Server Tips and Tricks, Table Permission, TSQL
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Anvesh Patel { Great... }
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....