February 24, 2005 at 12:23 pm
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
February 24, 2005 at 12:37 pm
exec sp_changeobjectowner 'myuser.payroll', 'dbo'
-------
at us, very deafly, a most stares
collosal hoax of clocks and calendars
eecummings
February 24, 2005 at 12:46 pm
Thanks!
I forgot to mention that I have 100 objects, how to do all this object at Once
Nita
February 24, 2005 at 1:03 pm
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
February 24, 2005 at 1:55 pm
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
February 24, 2005 at 11:51 pm
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
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy