473,847 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cannot add windows user, cannot delete sql user

We were using sql authentication on our sql server 2000 servers, But
need to use windows authentication. I have an sql user jdoe that owns
many different objects in multiple databases. I have tried adding the
windows login of jdoe with the exact same permissions as the sql user
jdoe, but it complains because it says jdoe already exists. So I
attempt to delete the sql user of jdoe (remembering the permissions so
I can reapply them to the windows user soon to be created) But it says
"you cannot drop the selected login id because that login id owns
objects in one or more databases" So now I am trying to figure out how
to change the ownership of those many many objects in the many
databases from jdoe to dbo so I can delete this sql user of jdoe. Does
anyone know of a way to convert an sql login to a windows login? Or if
that can't be done, how to change the owner of many objects to dbo so I
can delete this user? Maybe a T-SQL script or stored procedure. There
is a stored procedure called sp_changeobject owner but that only works
for one object, how would I do that on all the objects that jdoe owns?
As you can see I am a newbie but I appreciate any help you can
provide!!! Thanks in advance!

Jul 23 '05 #1
3 9459

"tbone" <to**********@g mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
We were using sql authentication on our sql server 2000 servers, But
need to use windows authentication. I have an sql user jdoe that owns
many different objects in multiple databases. I have tried adding the
windows login of jdoe with the exact same permissions as the sql user
jdoe, but it complains because it says jdoe already exists. So I
attempt to delete the sql user of jdoe (remembering the permissions so
I can reapply them to the windows user soon to be created) But it says
"you cannot drop the selected login id because that login id owns
objects in one or more databases" So now I am trying to figure out how
to change the ownership of those many many objects in the many
databases from jdoe to dbo so I can delete this sql user of jdoe. Does
anyone know of a way to convert an sql login to a windows login? Or if
that can't be done, how to change the owner of many objects to dbo so I
can delete this user? Maybe a T-SQL script or stored procedure. There
is a stored procedure called sp_changeobject owner but that only works
for one object, how would I do that on all the objects that jdoe owns?
As you can see I am a newbie but I appreciate any help you can
provide!!! Thanks in advance!


First, change the owner of all jdoe's objects to dbo - one way is to execute
the output of a query like this one:

select 'exec sp_changeobject owner ''' + name + ''', ''dbo'''
from sysobjects
where uid = user_id('jdoe')

Then drop the jdoe database user and login, create the new login for the
Windows account, and give it database access. If you want the new user to
own the objects again, then just do a quick find and replace on the original
script to change 'dbo' to 'jdoe' or 'MyDomain\jdoe' or whatever the database
user name is.

Simon
Jul 23 '05 #2
Then drop the jdoe database user and login, create the new login for the
Windows account, and give it database access. If you want the new user
to
own the objects again, then just do a quick find and replace on the
original
script to change 'dbo' to 'jdoe' or 'MyDomain\jdoe' or whatever the
database
user name is.
After I change the ownership to dbo, all the objects in the database
will be dbo now, I guess I can change those objects to a temp user so I
can distinguish them from the rest of the dbo objects. Anyway, is there
any way i could do this by changing the uid mappings or something? Each
database has a user that links to a login correct? Is there a way to
link the already existing user to the new windows login?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
t bone (bi*********@ya hoo.com) writes:
After I change the ownership to dbo, all the objects in the database
will be dbo now, I guess I can change those objects to a temp user so I
can distinguish them from the rest of the dbo objects. Anyway, is there
any way i could do this by changing the uid mappings or something? Each
database has a user that links to a login correct? Is there a way to
link the already existing user to the new windows login?


Don't think so. I was about to suggest trying sp_change_users _login, but I
see in Books Online that it doesn't work for Windows logins.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6477
by: Phil Powell | last post by:
print_r(is_file("$logPath/$logFileName")); // RETURNS 1 unlink("$logPath/$logFileName"); // RETURNS WARNING: PERMISSION DENIED This code should tell me that the file located at $logPath/$logFileName should delete the log file, however, it never deletes it due to permissions error. However, upon checking the file properties I find this:
0
2814
by: Ola Ogunneye | last post by:
--=_075912CF.F899D547 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello again all, I have created an account in the particular database that I was trying to backup Using PHPMYADMIN and I also created the same user account on the OS side. I still got the same 1064 message afterwards. I am still relatively new to Mysql and my adding user only works when I use
2
578
by: Dipak Patel | last post by:
Platform: Win2000 SP3, SQL 7.00 - 7.00.1063 I have a SQL-authenticated user with the following permissions: "Process Administrators" server role "db_owner" and "TargetServersRole" for msdb database "db_owner" for master database. The problem is that when this user opens up any job (i.e. owned by any user) in the SQL Server Agent, and goes to the Notifications tab, the first three alerts (Email, Page and Net send) are greyed out, i.e.
8
5486
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
3
2355
by: Steven Fox | last post by:
============================================================ About DB2 Administration Tools Environment ============================================================ DB2 administration tools level: Product identifier SQL08015 Level identifier 02060106 Level DB2 v8.1.5.449 Build level s040212 PTF WR21334...
4
1860
by: sea | last post by:
I have a database in Access 2002 but I am unable to view code or write any modules when logged in with a limited user account using Windows XP, service pack 2 -- no problems when logging in as administrator, -- any ideas on how a limited user on Windows XP can access code and modules in Access 2002? Thank you very much.
0
9857
by: pankajprakash | last post by:
Hi all I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name: element". Here am posting the whole .ascx page. Will you please let me know how can i remove this error.
2
15016
by: SCPOS | last post by:
Cannot delete X: It is being used by another person or program. Close any programs that might be using the file and try again. Of course I have tried closing any programs I know of that may be using the file (used X because the filename does not matter...it is a specific log file name to the application). I am logged onto a Windows Server 2003 computer that acts as a server for a LAN, but is physically joined to a domain. The local...
17
12770
by: mandanarchi | last post by:
Access 2003; PC with Windows XP; SBS 2003 I tried searching the forums but it came up with a blank page. I searched Google and found an answer; but the 'problem' doesn't relate to our situation! We have a table with 24 fields; 1 AutoNumber; 1 Yes/No; 1 Memo; 2 Currency; 5 Number and the rest Text. The AutoNumber (PK), one Text (No Duplicatess) and one of the Number fields (Duplicates OK) are indexed. There is a form to add records to...
0
9890
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9733
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10715
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10346
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9489
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7060
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5724
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.