SQL SERVER – Fix : Error : Msg 15151, Level 16, State 1, Line 2 Cannot alter the login ‘sa’, because it does not exist or you do not have permission

Few days ago, I have wrote about SQL SERVER – DISABLE and ENABLE user SA I received following email from one of the user who received following error.

Msg 15151, Level 16, State 1, Line 2
Cannot alter the login ‘sa’, because it does not exist or you do not have permission.

Fix/Workaround/Solution:
This error had occurred because of insufficient rights. Please read my previous post here before reading further article.

SA is system admin user and it is the highest level of user in system. If any user have to modify the permissions of SA that user needs to have higher or equivalent rights as SA user. Users member of systemadmin group are can only change the rights of SA user.

First adding any user to systemadmin role and then using the same user to modify system admin’s tool will fix the issue.

Reference : Pinal Dave (http://blog.SQLAuthority.com)

About these ads

17 thoughts on “SQL SERVER – Fix : Error : Msg 15151, Level 16, State 1, Line 2 Cannot alter the login ‘sa’, because it does not exist or you do not have permission

  1. I am trying to disable BUILTIN\Administrators

    ALTER LOGIN [BUILTIN\Administrators] DISABLE

    gives me this error.

    Msg 15151, Level 16, State 1, Line 1
    Cannot alter the login ‘BUILTIN\Administrators’, because it does not exist or you do not have permission.

    I am logged in as “SA”

    Thanks,
    IM

  2. Hi Mr Dave !

    I’m Hoang Nguyen. I had abig trouble and need to explrore so much.

    I installed SQL Server 2005 Express Edition, but in my VIEW options, i can not find out where is Solution Explorer and Toolbox windows, help me pls. What problem is that ???

    Pic of my SQL Management Studio here:

  3. @Hoang

    This is because may be you have SQL Server Management Studio Express.

    You might want to download SQL Server EXPRESS Edition (Free) , with which you will get free client tools.

    This client tools will have solution explorer and tools.

    Download SQL server Express edition from this link.

    Link : http://go.microsoft.com/fwlink/?linkid=65212

    Download this file and run this file.

    Regards,
    Imran.

  4. Pingback: SQL SERVER - Add Any User to SysAdmin Role - Add Users to System Roles Journey to SQL Authority with Pinal Dave

  5. I cannot see “solution explorer” under the view tab in sql server 2005 management studio express.

    the first time I installed SQLEXPR.EXE and connected to database and I couldn’t see “solution explorer” on the view tab. so I uninstalled it.

    next Iinstalled SQLEXPR32.EXE and I still didn’t see “solution explorer” under the view tab in 2005 management studio.

    can you tell me what to do.

    also, I wanted to know if i install sql server 2008 express will I be able to see “solution explorer” tab in 2008 express management studio.

    Thank you so much

    wayne

  6. hello mr. dave, i submitted a question about object explorer. I am currnently running sql server 2005 express.

    when i login and connect to object explorer and can see the databases and I it work find. But i noticed that i do not see the solution explorer when I click on the view tab.

    is there a way that i can add solution explorer to the view under the view tab in management studio 2005 express?

    I would like to use solution explorer if possible.
    Thanks

    Wayne

  7. Hi

    I have two databases, say DB1, DB2. DB1 has a view, say vw, and DB2 has a procedure, say proc. All objects in database are associated to dbo schema, and there is only one login ‘sa’.

    Problem is through [DB2].[dbo].[Proc], I am trying to refresh [DB1].[dbo].[vw] using following statement:

    execute sp_refreshview ‘[DB1].[dbo].[vw]’

    Following exception is raised, which is I am not able to resolve:

    Msg 15165, Level 16, State 1, Procedure sp_refreshsqlmodule_internal, Line 55
    Could not find object ‘[DB1].[dbo].[vw]’ or you do not have permission.

    Please let me know how I can resolve this issue or what alteranate I can use.

  8. create login mm with password=’pwd’
    drop login mm
    sp_addlogin ‘qq’,’pwd’,’master’
    sp_droplogin ‘qq’
    create table q(id int )
    insert into q values(79)
    select * from q
    grant select on q to qq

    and finally it is showing error msg like this

    Msg 15151, Level 16, State 1, Line 1
    Cannot find the user ‘qq’, because it does not exist or you do not have permission.

  9. i have problem with SQL Express 2008 R2 i have restore the database and connected the application it throws an exception like Stored procedure not found in that database all SPs and tables are present like this [mruser].[SPname] so it throws the exception

  10. You must be an Administrator on the box to enable the SA user or other SysAdmin users. In addition to that, you probably need to run SQL Server Management Studio as an Administrator. Right click on the SQL Server Management Studio icon and select Run As Administrator. Once you do this and then attempt to enable the SA login, it should work.

  11. Eric, I tried running SQL Server Mgmt Studio as an Administrator and got enabled the SA login perfectly. But now when I disconnect and try to connect using the SA login, it throws the following exception:

    Login failed for user ‘sa’. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452).

    Please suggest me with an option to eradicate this issue.

  12. i hv craeted login abc,wen i logged from that login it will not allow me add user db in user mapping show a error 15151,
    i want to give privigdes to user db by using this login.

    pls suggest
    thanks in advance
    kiran

  13. Pingback: SQL SERVER – Weekly Series – Memory Lane – #009 « SQL Server Journey with SQL Authority

  14. Hi master

    i’m an Administrator of DB and i run this query:
    CLOSE ALL SYMMETRIC KEYS;
    GRANT VIEW DEFINITION ON SYMMETRIC KEY::KEYEX TO user_me

    and give-me the same error:
    Cannot find the symmetric key ‘KEYEX’, because it does not exist or you do not have permission.

    any help?

    Best Regards,
    Roger

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s