Which Transact-SQL statement should you use?

You are migrating a database named Orders to a new server that runs Microsoft SQL Server 2012.
You attempt to add the [Corpnet\User1] login to the database. However, you receive the following
error message:
“User already exists in current database.”

You need to configure the [Corpnet\User1] login to be able to access the Orders database and retain
the original permissions. You need to achieve this goal by using the minimum required permissions.
Which Transact-SQL statement should you use?

You are migrating a database named Orders to a new server that runs Microsoft SQL Server 2012.
You attempt to add the [Corpnet\User1] login to the database. However, you receive the following
error message:
“User already exists in current database.”

You need to configure the [Corpnet\User1] login to be able to access the Orders database and retain
the original permissions. You need to achieve this goal by using the minimum required permissions.
Which Transact-SQL statement should you use?

A.
DROP USER [User1];
CREATE USER [Corpnet\User1] FOR LOGIN [Corpnet\User1];
ALTER ROLE [db_owner] ADD MEM3ER [Corpnet\User1];

B.
ALTER SERVER RCLS Isysadmin] ADD MEMBER [Corpnet\User1];

C.
ALTER USER [Corpnet\User1] WITH LOGIN [Corpnet\User1];

D.
ALTER ROLE [db owner] ADD MEMBBR [Corpnet\User1];

Explanation:
http://msdn.microsoft.com/en-us/library/ms176060.aspx



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Kevin Burgess

Kevin Burgess

Just in case the question comes up in the exam, the following can also be used:

exec sp_change_users_login ‘AUTO_FIX’,”;

But curiosly enough the user Looks like an AD-User so the SID and association to the database should be intact.

Has anyone seen this question in the exam?