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 (https://blog.sqlauthority.com)

SQL Error Messages, SQL Scripts, SQL Server Security
Previous Post
SQLAuthority Author Visit – Valsad, Daman, Silvassa, Vapi – Tech Meetings
Next Post
SQL SERVER – Add Any User to SysAdmin Role – Add Users to System Roles

Related Posts

20 Comments. Leave new

  • 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

    Reply
  • 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:

    Reply
  • @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 :

    Download this file and run this file.

    Regards,
    Imran.

    Reply
  • 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

    Reply
  • 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

    Reply
  • Shailender Singh
    April 9, 2011 2:01 pm

    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.

    Reply
  • 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.

    Reply
  • Mauricio Gracia G
    June 24, 2011 8:30 pm

    When trying to apply this process I get this error : You dont have permissions to perform this action (Microsoft SQL Server, Error: 15247)

    Reply
  • I had same problem.
    My computer has install windows 7 and SQL Server 2008 Express.
    Can’t change password for ‘SA’

    Reply
  • 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

    Reply
  • 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.

    Reply
  • 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.

    Reply
  • 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

    Reply
  • 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

    Reply
  • Excellent article! We will be linking to this great content on our site. Keep up the great writing.

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

    Reply
  • WOW just what I was searching for. Came here by searching
    for domain

    Reply
  • Anand Kumar Singh
    December 10, 2015 5:23 pm

    Hello Mr. PINAL DAVE,

    I have a query related to sql server security point of view. I just give brief of my situation, I am running SQL server 2014 r2 in that around 8 database was created, it was running with no problem since 2 years, but recently i m getting issue like suddenly my entire database say any one complete database got deleted that means all tables of that database became blank. When i started “SQL server Profiler” to record session, i saw one query is running like Select name from sys.tables and then one by one all table name of that database with the statement like– delete from employee and so on.. i could not able to get the information why and from where this query is running.

    DO you have any idea, how this cause is keep on coming from past 2 weeks.
    please reply ASAP.

    Please Note:- I am hosting one internal website in IIS server with windows server 2008 and sql server 2014(last 1 year or so) currently and 2008 earlier

    Thanks
    anand kumar singh

    Reply
  • Thanks Pinal Dave

    Worked a charm :-)

    God bless all they guys & girls like you who help as out all over the world on a daily basis.

    Your efforts are much appreciated.

    Happy New Year !

    Regards,
    Win

    Reply

Leave a Reply