User ID

  • I copied database called mydb from development to production, but all the objects belongs to myuser and that userid is not in the production. How should I replace myuser objects to dbo?????

     

    for example a table called payroll its belong to

    myuser.payroll

     

    Thanks

    Nita

  • exec sp_changeobjectowner 'myuser.payroll', 'dbo'

     


    -------
    at us, very deafly, a most stares
    collosal hoax of clocks and calendars

    eecummings

  • Thanks!

    I forgot to mention that I have 100 objects, how to do all this object at Once

    Nita

     

  • I would research performing a loop with sysojects where the objects are "owned" by the non-existent userid.  This way you could set-up dynamic SQL ...



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Try This, it will build the results in the window of QA.

    You can then cut and paste and execute the results.

    SELECT '''EXEC SP_ChangeObjectOwner ''' + User_Name(uid) + '.' + name + ''', ''dbo''' FROM SysObjects WHERE xtype = 'P' AND User_Name(UID) <> 'dbo'

     

    Oh, change the xtype to whatever you need, p = SPs


    KlK

  • You can try to write your  objects cursor and then execute sp_changeobjectowner

Viewing 6 posts - 1 through 5 (of 5 total)

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