Showing posts with label databasethanks. Show all posts
Showing posts with label databasethanks. Show all posts

Friday, March 23, 2012

Script to delete all objects

Can anyone point me to script to delete all objects owned by a user before I
delete the user from a database?
Thanks.
Michael Tissington
http://www.oaklodge.com
http://www.tabtag.comHello
We can run the following code to find the objects owned by a user:
declare @.usrname as varchar(30)
set @.usrname='sqluser'
select name,xtype from sysobjects where uid = user_id(@.usrName)
However, I am afraid that we may need to delete the objects manually one by
one.
Sophie Guo
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
========================================
=============
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.