change an object owner

  • Is there a way I can change the object owner. I want to change the stored procedure owner.

    OR you could help me in this:

    My asp page cannot find the stored procedure created by a owner after i exported my database to a new sql server.

    I was not able to complete the export as it gave me some invalid column error. It completed 96%. So i deleted that and just copied the mdb and ldb files and attached to the new sql server database. But I was not able to add a user already existing in that database using the security > Logins. It says user already exists but i cannot see my asp pages as the user cannot login. This user owns many object so i cannot delete and add him again. In the database user the name shows as "maggie" but the loginname is blank. How can add this user or change the ownership of the objects this user owns.

  • 1) Look at sp_changeobjectowner in BOL.

    2) Look at sp_change_users_login to sync the old account to the new one on the new server. Access will be same it is that the sid don't match on the new server in the old DB.

    Edited by - antares686 on 05/12/2003 2:39:59 PM

  • I Looked at sp_change_users_login. I don't what to change and how should I do it. I am not familier with sp.

    Can u please write detailed steps for me.

  • Ok I am gonna start as from the top.

    1) On the new server create your suer without a default DB or any permissions to DBs accept those that already exist on the server beforehand.

    2) Attach the DB you are copying over.

    3) Open QA connected to the DB you just attached.

    4) Run

    EXEC sp_change_users_login @Action = 'Update_One'

    , @UserNamePattern = 'LoginNameInTheAttachedDB'

    , @LoginName = 'LoginNameToAssociateWithOnServer'

    5) Correct default DB of the Login Account and any permissions that need to be fixed and maike sure can login and access the resources you need it to.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply