views:

61

answers:

3
ALTER USER [myuser] WITH LOGIN =[myuser]

This query returns error in one of the SQL Server 2005 SP1 installation. Error is

Incorrect syntax near 'LOGIN'

A: 

Try

ALTER LOGIN Login WITH name = NewLogin
buckbova
I want to alter user not login.
Rohit
+1  A: 

Several things

  • You do not need to use [] around the user name and login you want.
  • You seem to be trying to change the login to itself. That can't be right.

Try this:

ALTER USER myuser WITH LOGIN = myLOGIN

See the ALTER USER documentation on MSDN.

Oded
The query does not work < SP2
Rohit
@Rohit - You really don't like to give details, do you? _What_ error message? You understand that you need to replace `myuser` and `myLOGIN` with the correct ones, right? What exactly are you trying to do?
Oded
+1  A: 

The problem seems to be a bug in SQL Server 2005.

It is fixed at SP2. So, The the fix is to upgrade it to SP2 or above.

Rohit