Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Login owns objects... NOT !

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-02 : 22:03:53
A buddy of mine has restored an SQL 7 database. The Login "joe" cannot be deleted from the database because "it owns objects"... only I can't find the objects it owns.

I'd like to delete Login "joe" from the database so we can assign "joe" on the server to that database.

Sam

Westley
Posting Yak Master

229 Posts

Posted - 2005-10-02 : 22:34:34
You can change the owner of the objects to dbo instead of joe, and you can delete login joe from the DB.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-02 : 23:04:22
quote:
Originally posted by Westley

You can change the owner of the objects to dbo instead of joe, and you can delete login joe from the DB.


If I could find an object owned by Joe I would !
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-03 : 00:01:50
Have your ran the sp_change_users_login or whatever it's called on the database?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2005-10-03 : 00:39:30
maybe an sp_changedbowner 'sa' also
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-03 : 01:06:09
sp_change_users_login is new to SQL 2000. (This is SQL 7).

All the objects I can see using EM are owned by dbo. Isn't there a query I can run against sysobjects that'll show me what object(s) Login "Joe" is thought to own?

Sam
Go to Top of Page

Westley
Posting Yak Master

229 Posts

Posted - 2005-10-03 : 01:32:52
maybe its not tables? maybe its a store proc or views?
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-03 : 01:35:39
Match the uid in sysobjects to the uid in sysusers?

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-03 : 08:49:03
quote:
Originally posted by derrickleggett

Match the uid in sysobjects to the uid in sysusers?
I never *ever* look in these tables, so this is what I needed.
select top 10 *
from sysobjects so
inner join sysusers su on su.uid = so.uid
where su.name = 'joe'


-- I'm learning things I never wanted to know...
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-03 : 08:55:00
Oops... How do I add a WHERE to specify the DB name I'm concerned about? Looks like sysdatabases holds the db names, the key is dbid, but I don't see a similar key in sysobjects.

Someone's going to tell me to read a book. I just know it.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-03 : 09:44:36
You have to run that in each database. Think about it. Long day???

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-03 : 13:22:55
quote:
Originally posted by derrickleggett

You have to run that in each database. Think about it. Long day???
I thought these sysxxxx tables were held in Master. Would you look at that! They're in every database...

It's hard enough understanding my own data. Now I gotta learn Microsoft's.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-03 : 13:37:28
"They're in every database..."

Well ... sysdatabases isn't

Kristen
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-10-04 : 10:02:42
quote:
Originally posted by Kristen

Well ... sysdatabases isn't

Hey ! Stop having fun at my expense !
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-10-04 : 14:09:50
I suppose you could put a VIEW in each DB to master.dbo.sysdatabases, and call it ... ermmm ... "sysdatabases"

"Stop having fun at my expense"

Sorry, only just read that bit :)

Kristen
Go to Top of Page
   

- Advertisement -