You administer a Microsoft SQL Server 2012 database named ContosoDb. The database contains a table named Suppliers and a column named IsActive in the Purchases schema. You create a new user named ContosoUser in ContosoDb. ContosoUser has no permissions to the Suppliers table. You need to ensure that ContosoUser can delete rows that are not active from Suppliers. You also need to grant ContosoUser only the minimum required permissions. Which Transact- SQL statement should you use?

 Posted by Bandi on 7/30/2014 | Category: Sql Server Interview questions | Views: 5191 | Points: 40
Select from following answers:
  1. GRANT DELETE ON Purchases.Suppliers TO ContosoUser
  2. CREATE PROCEDURE Purchases.PurgeInactiveSuppliers WITH EXECUTE AS USER = ‘dbo’ AS DELETE FROM Purchases.Suppliers WHERE IsActive = 0 GO GRANT EXECUTE ON Purchases.PurgelnactiveSuppliers TO ContosoUser
  3. GRANT SELECT ON Purchases.Suppliers TO ContosoUser
  4. CREATE PROCEDURE Purchases.PurgeInactiveSuppliers AS DELETE FROM Purchases.Suppliers WHERE IsActive = 0 GO GRANT EXECUTE ON Purchases.PurgeInactiveSuppliers TO ContosoUser
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response