SQL Server Performance

How to change login name

Discussion in 'Getting Started' started by AJITH123, Mar 6, 2008.

  1. AJITH123 Member

    Hi,
    I have a data base with owner = dbo and login as 'Test', i need to change the login name as 'sa' instead of 'Test' ...can anyone help ??
    Thanks
  2. satya Moderator

    Only one name of SA can exists and if you want to change database owner to SA then you can use SP_CHANGEDBOWNER.
    If you want to rename a login then drop and recreate a fresh one.
  3. AJITH123 Member

    Hi,
    Let me explain th eissue once again, I have an old data base, when restore the same, if we goes to the users, it is showing Name = dbo, Login Name = 'Test' and database access= 'Permit'. However the application is connecting through the login 'sa', [i dont know where it is configured in the application, i do not have access to that] so i need to change this login name as 'sa' instead of 'Test'. it should be like Name = dbo, Login name = sa and database access = 'permiot'. Is it possible ?
    Thanks
  4. Adriaan New Member

    'sa' is a SQL Server login that exists in all instances of SQL Server. It has system administrator permissions on all databases, so it is essential that it is used with caution.
    If you have an application that uses 'sa' to connect to a database, then I would say that this application was created without any understanding of security concepts.
  5. AJITH123 Member

    Yes you are correct, this is the legasy application.....
  6. ysrysr New Member

    EXEC sp_change_users_login 'Update_One', 'dbo', 'sa';
  7. Adriaan New Member

    You should be able to login as 'sa' and do everything that a member of the db_owner database role can do.
    When logging on with 'Test', make sure that when you create a new object, that you always spell out 'dbo' as the owner:
    CREATE TABLE dbo.table ....
  8. johnson_ef Member

    Can you try with sp_changedbowner system SP?
    Only limitation for this SP is, this can not be used for 'System Databases'
    Regards
    -Johnson
  9. AJITH123 Member

    Hi everyone..Thanks for the help it resolved.....

Share This Page