Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Question about Sql Accounts and Deletion Management

Posted on 2016-09-21
1
50 Views
Last Modified: 2016-09-23
Question about Sql users.  I have a sql user that is added in the security section of the actual database.  I have the same user located in the instance level of security.  I deleted the user at the instance level but the user remained at the database level.  What is the proper way to delete a user if I totally want to rid the instance and all databases of this user login.

Also, all of the users in question should not be a owner of the database.

Question.... is there any danger in data being inaccessible after deletion of these users.

also, if i happen to delete a database owner..... i can always reassign that role to another user from an SA login.... Please verify.
0
Comment
Question by:jamesmetcalf74
1 Comment
 
LVL 48

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 41808899
I have a sql user that is added in the security section of the actual database.  I have the same user located in the instance level of security.  I deleted the user at the instance level but the user remained at the database level.  
That's because the first is a SQL Login and the second a Database User.

What is the proper way to delete a user if I totally want to rid the instance and all databases of this user login.
Proper way is to delete both (Login and database user).
DROP LOGIN <loginName>
GO
USE databaseName
DROP USER <userName>

Open in new window


Question.... is there any danger in data being inaccessible after deletion of these users.
For user that user won't be able to access the data anymore but others users still can. Just be sure you let at least one login with sysadmin server role to fix the things if needed.

also, if i happen to delete a database owner..... i can always reassign that role to another user from an SA login
True. For that run the following:
USE DatabaseName
EXEC sp_changedbowner 'UserName'

Open in new window

1

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
run a stored procedure from vb.net 1 27
t-sql need help on t-sql 10 25
Re-appearing SQL Server Agent jobs 7 28
RAISERROR WITH NOWAIT 2 14
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question