Database Diagram error on SQL 2005

I upgraded from SQL 2000 to SQL 2005. The database owner is sa and I am logging in as sa in Management Studio. But when I click on Database diagrams I get the following error
"Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects."

How can I fix it


Answer this question

Database Diagram error on SQL 2005

  • ali sedran

    When trying to add a diagram to an SQL Server 2005 db I got the following error:

    Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.

    I tried the suggestion mentioned in the message but that didnt work. Also found that SQL Server Management Studio does not like you trying to change various permissions - it only works certain ways (go figure).

    Anyway, eventually found this post with the solution (thanks very much to cutiepie) being:

    In SQL Server Management Studio do the following:

    1. Right Click on your database, choose properties
    2. Goto the Options Page
    3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"

  • Besnik.S

    This worked for me:

    ALTER AUTHORIZATION ON DATABASE::MyCompany TO sa

    Don't know what sa is, though....


  • vkuttyp

    You need to change the dbowner to a valid login. Attached / restored databases may not have a valid login on that target SQL instance

    ALTER AUTHORIZATION ON DATABASE::db_name TO [login_name]

    also you could refer "Installation of Database Diagram Support Objects Requires a Valid Logon Account" in following URL

    http://support.microsoft.com/default.aspx scid=kb;en-us;910228#XSLTH31018121121120121120120

    Thanks

    Sethu

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm.


  • Kmaure

    It helps me a lot. Thank You


  • n3tster

    This worked for me on a database imported from sql2000:

    sp_dbcmptlevel somedbfrom2000, 90

    ... and sp_dbcmptlevel has to be run by itself not in a batch


  • Sodan

    hi
    I have a problem and I saw another one had befor and u gave hime a way that was helpful.I have the same problem and do that way but it doesn't work for me.the story is, I change my laptop and install SQL 2005 server again.Now whene ever I try to open data diagram it gives me this message: ... does not have a vaild owner .... .I tried on my server(another pc) which has this database and sql server2005 together and I can open diagram.I don't know what should i do.I tried to use sp_dbcmptlevel but nothing happend

    bye

  • Emad.Hammoud

    hungfut wrote:

    Can you run the sp_dbcmptlevel to check the db compatiblity level for the db you are having problem If it's 80 or lower could you try to set it again to 90 to see if this problem still repro



    I did this and it solved my problem for one DB. However, it doesn't work for another DB. And yes, it has a valid owner.

  • nono92_b

    Can you run the sp_dbcmptlevel to check the db compatiblity level for the db you are having problem If it's 80 or lower could you try to set it again to 90 to see if this problem still repro



  • Nille

    thank you
  • Gary 1981

    Yes that fixed it.

  • Per S

    When Executing ALTER AUTHORIZATION ON DATABASE::ProjectManager TO [kamranshahid\yukon]

    I am getting this error

    Msg 15151, Level 16, State 1, Line 1

    Cannot find the principal 'kamranshahid\yukon', because it does not exist or you do not have permission.

    To overcome it Now I also have installed SP1 for sql server 2005.

    I have standard edition of sql server 2005 on my windows xp sp2 professional edition operating system.

    What Can I DO



  • Tom Kubit

    My problem is that I don't have any database diagram functionality unless I'm connected to the network. We use Active Directory and Smart Cards to authenticate. Any suggestions

    Thanks,

    joeslide


  • Database Diagram error on SQL 2005