Question

I don't want to create roles and play that way at the moment - just trying to get a Q&D on this. When I execute:

grant all to [LameDomain\CoolDude]

I get the DB barking that (a) the command is deprecated (kept for compatibility reasons only) and that (b) I can't do this to myself (and that's the real problem). NB, I'm the cool dude in the lame domain.

So, my questions are (in raising order of importance) as follows.

  1. What syntax can be used to grant all the privileges to self (one-liner if possible)?
  2. If necessary, what's the recommended syntax one should use to grant all to self?
  3. What's the current version of the command "grant all to XXX"?

EDIT

When I try to follow this article, I get the error that the user or role doesn't exist in the DB, when I try to execute sp_addrolemember. However, when attempting to call sp_grantdbaccess, I get that the user already has a name in the DB. WTF?!

Was it helpful?

Solution

You can add the user to system role db_owner. This way the user will have all permissions on the database including ALTER and CREATE objects.

Members of the db_owner fixed database role can perform all configuration and maintenance activities on the database.

USE_database_name
GO
EXEC sp_addrolemember 'db_owner', 'user_name'
GO

As for GRANT ALL you can still use it but it will give not all permissions. List of permissions that will be granted you can see in documentations on GRANT

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top