Solved

Question about Sql Accounts and Deletion Management

Posted on 2016-09-21
1
29 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 45

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now