Monday, March 26, 2012

how to change owner for many tables

sorry to be dumb!
i have a whole bunch of tables with me as owner - i want to make dbo owner.
how?
i just can't find an appropriate mouse click in enterprise manager, and i don't really want the 40 command lines to do it manually.
thanks for ideas, izyNo bulk way that I know of in Enterprise Mangler.

So we are reduced to being deviant... Er, devious. We use a script to write a script!SELECT 'EXECUTE sp_changeobjectowner ''[' + su.name + '].['
+ so.name + ']'', ''dbo'''
FROM dbo.sysusers AS su
JOIN dbo.sysobjects AS so
ON (so.uid = su.uid)
WHERE 'izy' = su.name
ORDER BY so.nameThis will create a script as its output that you can copy into query analyzer, exectute, and go merrily on your way.

-PatP|||big gulp!

Pat - thanks: that's really scary but i'll give it a thrash and see what falls out of the tree.

izy|||purrrrfect.

thanks a lot, izy|||See, it helps to have deviant... Er, devious friends!

Thinking "outside the box" is a bit difficult at first, but the dividends can be huge. I keep wondering "What box?" whenever I hear that phrase though!

-PatP|||See, it helps to have deviant... Er, devious friends!

Thinking "outside the box" is a bit difficult at first, but the dividends can be huge. I keep wondering "What box?" whenever I hear that phrase though!

-PatP

Boy that is such an opening...nah, better not...|||Boy that is such an opening...nah, better not...Allright! Where have you put the real Brett ?

-PatPsql

No comments:

Post a Comment