Re: Change Stored Procedure object owners for hundreds of objects

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 08/09/04


Date: Mon, 9 Aug 2004 14:25:27 -0400

SELECT 'EXEC sp_changeobjectowner '''+ROUTINE_NAME+''',''dbo'''
    FROM INFORMATION_SCHEMA.ROUTINES
     WHERE OBJECTPROPERTY(OBJECT_ID(ROUTINE_SCHEMA+'.'+ROUTINE_NAME),
'IsMsShipped')=0
     AND ROUTINE_SCHEMA != 'dbo'

Run that in Query Analyzer, copy the output to a new query window, and run
it. Mission accomplished.

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"C Downey" <colleenDowney65@homtail.com> wrote in message
news:u4IFW0jfEHA.708@TK2MSFTNGP09.phx.gbl...
> Is there a quick way to change the owner of all the stored procedures in a
> database?  I have a few hundred stored procedures that I have to update
and
> I want to avoid doing it all with sp_changeobjectowner.
>
> TIA!
>
>
>


Relevant Pages

  • Re: Is sql server as good as access 97?
    ... you might recall that the reason you had to use 'stacked' queries was that ... do not confuse 'stacked' queries with functions. ... Transact-SQL is your aim then use functions or call other stored procedures. ... As far as EM v Query Analyzer is concerned, ...
    (microsoft.public.sqlserver.programming)
  • Re: Performance Tool Question
    ... tool has a performance-optimizer ... Open a new window in query analyzer and type execute myprocedurename (type ... The execution plan will show all scans to be performed and will give hints ... > I am looking for a tool that will help optimize TSQL and Stored Procedures ...
    (microsoft.public.sqlserver.server)
  • Re: The Query Designer does not support the CASE SQL construct.
    ... >> You can build your query in Query Analyzer instead. ... >> (Reverse address to reply.) ... >>> David Lozzi ... >>> Delphi Technology Solutions, Inc. ...
    (microsoft.public.sqlserver.programming)
  • Re: tempdb log claiming its filling up
    ... >>(Reverse address to reply.) ... Twice in the last month Ive got an SQL alert ... >>> Both times this happened I was in Query Analyzer doing ... >>> disk space free where tempdb exists and its set to auto- ...
    (microsoft.public.sqlserver.server)
  • Query Analyzer Stops Responding
    ... I'm having a problem with Query Analyzer. ... When I close a Query window that had been opened from a saves .sql file, ... QA stops responding. ...
    (microsoft.public.sqlserver.tools)