Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Unanswered: 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, izy
    currently using SS 2008R2

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    No 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!
    Code:
    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.name
    This will create a script as its output that you can copy into query analyzer, exectute, and go merrily on your way.

    -PatP

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    big gulp!

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

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740

    Smile

    purrrrfect.

    thanks a lot, izy
    currently using SS 2008R2

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    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

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Pat Phelan
    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....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    Boy that is such an opening....nah, better not....
    Allright! Where have you put the real Brett ???

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •