Would this apply to tables too?
Dean Fiala <[EMAIL PROTECTED]> wrote: Sure, The stored procedures are all listed in the sysobjects table in the database ( type='P'), all you need to do is loop through them and call the statement you supplied with the name of the stored proc. This should work, all though you could also use a cursor. CREATE TABLE #SPs( ID int identity, SPName nvarchar(100)) INSERT INTO #SPs(SPName) SELECT [Name] from Sysobjects where type='P' DECLARE @i int DECLARE @iMax int DECLARE @changetext nvarchar(300) SELECT @iMax = Count(*) FROM #SPs SET @i = 1 while(@i <= @iMax) BEGIN SELECT @changetext = 'EXEC sp_changeobjectowner ''' + SPName + ''', ''dbo''' FROM #SPs WHERE ID = @i EXEC(@changetext) SET @i = @i + 1 END DROP Table #SPs On 9/12/05, sas0riza <[EMAIL PROTECTED]> wrote: > > Hi, > > Is is possible to change database object owners in a batch? For > instance, I want to change the owner of my SPs to 'dbo', instead of > one by one > > EXEC sp_changeobjectowner 'whatever_SP', 'dbo' > > Any help is greatly appreciated. > > Thanks. > > > > > > > > Yahoo! Groups Links > > > > > > > -- Dean Fiala Very Practical Software, Inc http://www.vpsw.com [Non-text portions of this message have been removed] SPONSORED LINKS Basic programming language Computer programming languages Programming languages Java programming language The history of computer programming language --------------------------------- YAHOO! GROUPS LINKS Visit your group "AspNetAnyQuestionIsOk" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
