Re: Change Stored Procedure object owners for hundreds of objects
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 08/09/04
- Next message: ===steve pdx===: "Re: question about syslogins and sysusers..."
- Previous message: anonymous_at_discussions.microsoft.com: "Re: SQL command to ROLLBACK"
- In reply to: C Downey: "Change Stored Procedure object owners for hundreds of objects"
- Messages sorted by: [ date ] [ thread ]
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! > > >
- Next message: ===steve pdx===: "Re: question about syslogins and sysusers..."
- Previous message: anonymous_at_discussions.microsoft.com: "Re: SQL command to ROLLBACK"
- In reply to: C Downey: "Change Stored Procedure object owners for hundreds of objects"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|