You are the administrator of a SQL Server system that contains databases named Marketing and Sales. Amanda has a Windows account that has been granted a login to the SQL Server, and she has been given access to the Marketing database. Now she needs view and edit permissions on the Sales database as well. Which T-SQL statements should you execute?

You are the administrator of a SQL Server system that contains databases named Marketing and Sales. Amanda has a Windows account that has been granted a login to the SQL Server, and she has been given access to the Marketing database. Now she needs view and edit permissions on the Sales database as well. Which T-SQL statements should you execute?


Answer: – EXEC sp_grantaccess ‘Amanda’, ‘AmandaU’
GO
EXEC sp_addrolemember ‘db_datareader’,’AmandaU’
EXEC sp_addrolemember ‘db_datawriter’,’AmandaU’

(To give Amanda access to another database, you first need to create a user account in the database; then, the easiest way to give her the necessary permissions is to add her to roles that already have the permissions assigned.)