SQLEXPRESS 2014 (?)
I'm a little confused about my exact version as I see 2012 and 2014 in various locations, but I'm sure my question doesn't depend on the version.
Problem: I can't change the database owner
I noticed this when I went to create a database diagram and the error said the database does not have a valid owner.
So for that database I went to Properties > Files and sure enough, the owner is wrong. Why? I had changed the name of the PC recently, actually a couple of times. When I finally got the name right, I ran the following commands in the query window:
SELECT @@SERVERNAME to get the current server name
and then
sp_dropserver <old name> |
go |
sp_addserver <new name>, local |
go |
to change the server name
The owner in the Properties > Files is for a pc name that doesn't exist. But when I click on the '...' button to the right to select a new Database Owner I can't select the primary account on the PC.
If I create a new database, it puts that old name in as the database owner.
I went down to <server>\Security\Logins and the old <pcname>\<username> is still listed, and I can't add the <newpcname>\<username> because it says that principle already exists . I'm afraid to make any other change without knowing for certain what to do.
So I'm stuck not understanding how to get a new database owner name on all the databases on this server.
Do I delete that old Login and then try to add in the new name?
Any help is appreciated.
- Edited by Alan Wheeler 11 hours 54 minutes ago