Home All Groups Group Topic Archive Search About
Author
2 Mar 2006 3:46 PM
mrprice
I have a need to remove all objects from a database where the type is User. 
Is there a fast way to do this?  Is there a way to get a list of these
objects so I could use a cursor to remove them?

Thanks,
Mark

Author
2 Mar 2006 3:52 PM
JT
You can do this through Enterprise Manager 2000 or Management Studio 2005.

Show quote
"mrprice" <mrpr***@discussions.microsoft.com> wrote in message
news:F486AC15-C720-43A7-A0B0-EC6E24FFDDC7@microsoft.com...
>I have a need to remove all objects from a database where the type is User.
> Is there a fast way to do this?  Is there a way to get a list of these
> objects so I could use a cursor to remove them?
>
> Thanks,
> Mark
Author
2 Mar 2006 3:56 PM
Keith Kratochvil
You would be left with system tables.  Have you thought about DROP DATABASE?

You can query the system tables to obtain the object name (and type).  You
would have to issue the appropriate DROP statement within your cursor...

SELECT Type, Name FROM sysobjects
WHERE type <> 's'
ORDER BY Type, Name

--
Keith Kratochvil


Show quote
"mrprice" <mrpr***@discussions.microsoft.com> wrote in message
news:F486AC15-C720-43A7-A0B0-EC6E24FFDDC7@microsoft.com...
>I have a need to remove all objects from a database where the type is User.
> Is there a fast way to do this?  Is there a way to get a list of these
> objects so I could use a cursor to remove them?
>
> Thanks,
> Mark

AddThis Social Bookmark Button