Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with T-SQL

  • Backup and SQL Server diagram opennig problem.

    Very often people who works with SQL Server database get the following error when they trying to open database diagrams after restoring database from back up:

    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.

    To fix this problem you should execute this T-SQL script:

    EXEC sp_dbcmptlevel 'yourDB', '90';
    go
    ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
    go
    use [yourDB]
    go
    EXECUTE AS USER = N'dbo' REVERT
    go