From: Tibor Karaszi on
ALTER AUTHORIZATION is a command, which you execute from a query window. The
command is well documented in Books Online. Let us know if you don't find it
or if you can't make heads or tails out of the syntax.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi



"Jeff" <it_consultant1(a)hotmail.com.NOSPAM> wrote in message
news:#pofZgtvKHA.2436(a)TK2MSFTNGP04.phx.gbl...
> I think the error has something to do with orphaned users, just as Tibor
> Karaszi is suggesting
>
> I did this select from the Masters table:
> select * from sys.databases
>
> There I found my database, I took a note of the owner_sid, and then I
> checked in sys.server_principals
> for that specific user, there the user wasn't found, none have that sid, I
> checked agaist the sid column.
>
> Tibor mentions running a alter authorization script, but I'm not sure how
> to run it
>
From: Jeff on
I successfully ran this script:
alter authorization on database :: myDb to ScriptLogin

Then I try to create a new user in the database and associate it with the
new login, then I get this eror:
"The login has already an account under a different user name (Microsoft Sql
Server, Error: 15063)"
I tryed this many times and each time I get error. I've also created totally
new logins (which don't have user associated with). and I get the same
error... The same happend above. ScriptLogin is a new login I created, when
creating I specified that default database should be myDb. After creating
login I ran the above script. Then I thought I needed to create the user in
the database - bang there the error appeared again

any suggestions?


From: Tibor Karaszi on
Are you saying that you made ScriptLogin the owner of the database and then
try to add that login as a user to the database? That won't fly. The owner
of a database already *is* a user in the database: dbo. You can't have a
login as two different users in the same database.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi



"Jeff" <it_consultant1(a)hotmail.com.NOSPAM> wrote in message
news:#LL1CY4vKHA.5036(a)TK2MSFTNGP02.phx.gbl...
> I successfully ran this script:
> alter authorization on database :: myDb to ScriptLogin
>
> Then I try to create a new user in the database and associate it with the
> new login, then I get this eror:
> "The login has already an account under a different user name (Microsoft
> Sql Server, Error: 15063)"
> I tryed this many times and each time I get error. I've also created
> totally new logins (which don't have user associated with). and I get the
> same error... The same happend above. ScriptLogin is a new login I
> created, when creating I specified that default database should be myDb.
> After creating login I ran the above script. Then I thought I needed to
> create the user in the database - bang there the error appeared again
>
> any suggestions?
>
>
From: embza tadesse on

Hi guys I am Embiza from Ethiopia,
I am new to Developers Dex.
But I like to answer to the following problem:

"
Login failed for user <user_name>. (Microsoft SQL Server, Error: 18456)"

Here is the solution.

Simply right click on the SQL Management Studio and click on
Run as .... Administrator . Enter password if asked and
it works fine.

Thank you guys
Cheers!
Embiza


*** Sent via Developersdex http://www.developersdex.com ***
From: Jeff on
I finally managed to get it solved. I had to use the alter athorization
command as Tibor suggested.

Some of my mistakes was that I wanted to specify a user in the connection
string (User Id) - instead I specified a login. Which it could be named
Login Id instead of User Id in the connection string!

However I get a 18456 error when trying to connect to my sqlserver database
at my host, based on the connection details I provided with: server address,
user id and password. I'm contacting my host to ask if they have any clue
whats wrong




"Tibor Karaszi" <tibor_please.no.email_karaszi(a)hotmail.nomail.com> wrote in
message news:ODfIuT5vKHA.3408(a)TK2MSFTNGP06.phx.gbl...
> Are you saying that you made ScriptLogin the owner of the database and
> then try to add that login as a user to the database? That won't fly. The
> owner of a database already *is* a user in the database: dbo. You can't
> have a login as two different users in the same database.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
>
>
> "Jeff" <it_consultant1(a)hotmail.com.NOSPAM> wrote in message
> news:#LL1CY4vKHA.5036(a)TK2MSFTNGP02.phx.gbl...
>> I successfully ran this script:
>> alter authorization on database :: myDb to ScriptLogin
>>
>> Then I try to create a new user in the database and associate it with the
>> new login, then I get this eror:
>> "The login has already an account under a different user name (Microsoft
>> Sql Server, Error: 15063)"
>> I tryed this many times and each time I get error. I've also created
>> totally new logins (which don't have user associated with). and I get the
>> same error... The same happend above. ScriptLogin is a new login I
>> created, when creating I specified that default database should be myDb.
>> After creating login I ran the above script. Then I thought I needed to
>> create the user in the database - bang there the error appeared again
>>
>> any suggestions?
>>
>>