Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Finding Objects Owned by non-DBO Users Expand / Collapse
Author
Message
Posted Friday, November 05, 2004 3:43 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, January 28, 2011 11:35 AM
Points: 75, Visits: 2
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/


1234
Post #145058
Posted Wednesday, December 15, 2004 8:30 AM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, February 10, 2014 8:41 PM
Points: 9, Visits: 83

Very handy script.

Note:  I have a few databases with spaces in the name of the database.  This frequently trips up scripts but yours is easy to enhance for such a situation.  Simply change below line:

 , SU.name,SO.name  from '+@dbname+'.dbo.sysobjects SO join '+@dbname+'.dbo.sysusers SU

to:

 , SU.name,SO.name  from ['+@dbname+'].dbo.sysobjects SO join ['+@dbname+'].dbo.sysusers SU

Thanks for sharing your code.

-Mike




Regards,

Mike
Post #151178
Posted Wednesday, December 15, 2004 8:52 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, November 20, 2006 10:12 AM
Points: 78, Visits: 1

Definitely a handy script.  Although the developers in my company all have dbo privileges to the development database, our Windows Group login is mapped to a user other than dbo.  We are forever creating procedures without specifying the [dbo]. in [dbo].[<procedurename>] and ending up owning the procedure instead of dbo.

I would make one enhancement to the script. Right after the SET NOCOUNT ON line, I would add this line:

DELETE FROM [ObjList]

to prevent duplicates from a previous execution from appearing in the table

Post #151185
Posted Thursday, December 16, 2004 4:56 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, January 28, 2011 11:35 AM
Points: 75, Visits: 2

Mike,

Thanks for the suggestion.

 

Santveer




1234
Post #151367
Posted Thursday, December 16, 2004 5:03 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Friday, January 28, 2011 11:35 AM
Points: 75, Visits: 2

I didn't include DELETE FROM [ObjList] becuase I want to maintain the history also. If some one don't want to maintain the history, he/she may include the DELETE statement. This is just a concept and we can use it in different ways.

Thanks a lot for your time.




1234
Post #151370
Posted Thursday, December 15, 2005 7:08 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, December 05, 2013 1:03 PM
Points: 352, Visits: 110
It is a usefull Script; however, I will avoid the cursor.
Post #244444
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse