patternMinor
Changing SQL Server 2000 usernames
Viewed 0 times
2000usernamessqlserverchanging
Problem
We're running a SQL Server 2000 instance with users tied to Windows accounts. Many of the usernames have spaces in them and that is causing us some problems now. We would like to be able to rename them to get the spaces out, but I'm unable to figure out how this is done. I would love some help on this.
Solution
Some notes
The 2nd bit will fix your issue with implied schema. This happens if don't qualify schema (eg dbo) because SQL Server 2000 has pretty much no user-schema separation like later versions
Note: you can't rename users in SQL Server 2000 IIRC: need to run sp_revokedbaccess then sp_grantdbaccess. If you own objects because of your implied schema then you'll need sp_changeobjectowner. I think SQL EM will prompt you.
That is, you should always qualify schema in SQL Server.
Then no need to change the users
- When you create a login, then the name must match AD exactly
EXEC sp_grantlogin 'DOMAIN\Andy Soell- When you map the login to a database user, it can be renamed
EXEC sp_grantdbaccess 'DOMAIN\Andy Soell', 'Dilbert'The 2nd bit will fix your issue with implied schema. This happens if don't qualify schema (eg dbo) because SQL Server 2000 has pretty much no user-schema separation like later versions
Note: you can't rename users in SQL Server 2000 IIRC: need to run sp_revokedbaccess then sp_grantdbaccess. If you own objects because of your implied schema then you'll need sp_changeobjectowner. I think SQL EM will prompt you.
That is, you should always qualify schema in SQL Server.
CREATE TABLE dbo.viewname...
SELECT * FROM dbo.myTable
EXEC dbo.MyProcThen no need to change the users
Code Snippets
CREATE TABLE dbo.viewname...
SELECT * FROM dbo.myTable
EXEC dbo.MyProcContext
StackExchange Database Administrators Q#3351, answer score: 4
Revisions (0)
No revisions yet.