Error recreating a user on NAV

taher.bha
taher.bha Member Posts: 48
edited 2008-07-11 in SQL General
Hi all,
Am having the following problem when trying to reCreate A user on Dynamics NAV 5.0 that uses an SQL 2005 Database.
2714,"42S01",[Microsoft][ODBC SQL Server Driver][SQL Server]Il existe déjà un objet nommé 'UserZ' dans la base de données.
2759,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server]Échec de CREATE SCHEMA en raison d'erreurs antérieures.

SQL:
{CALL [sp_grantdbaccess](?)}
Sorry but am using a french version of SQL Server 2005. Here's my own traduction of the two first lines :

2714,"42S01",[Microsoft][ODBC SQL Server Driver][SQL Server]An object named 'UserZ' already exists on the database.
2759,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server] CREATE SCHEMA failed due to anterior Errors.

Here's what i did exactly before starting getting this error :
The user UserZ was in the database but i removed it directly using the Server Management Studio (context menu on MyServer->Security->Logins->UserZ)
As the userZ was a user on 2 Databases (MyServer->Databases->DB1->Users) I tried removing it directly using the context menu with no success.
I run the following T-SQL Command
select * from information_schema.schemata
where schema_owner = 'UserZ'
and got one line. I used the found schema_name :
Alter authorization on schema::UserZ to dbo
I could then delete the User using
drop user UserZ
I did the same on a second database.

Any ideas ?

Answers

  • garak
    garak Member Posts: 3,263
    is there allready a user (SQL User) on the Server :?:
    is there allready a user (SQL User) on the database because its a copy of a database from a other server :?:
    Do you make it right, it works too!
  • taher.bha
    taher.bha Member Posts: 48
    Waou!!!, already one response ! Looks like a chat :)
    I recreated the user as it's a requirement to create Users inside Navision.
    There are other users but all of them were created directly on the current server.
  • taher.bha
    taher.bha Member Posts: 48
    I tied the following :
    SELECT * 
    FROM INFORMATION_SCHEMA.SCHEMATA
    
    In the resultset I got a line with UserZ as Schema_Name
    May this help ?
  • taher.bha
    taher.bha Member Posts: 48
    Hi all,
    I could finally create the User on the master Db and the Dbs that were used by the User 'UserZ'.
    Don't ask me why cause i cannot reaaly understand what it was. It seems that the schema userZ was still used in one of the DB. I ran the following commands on the All the Dbs used.

    drop user adelZ
    drop schema AdelZ
    drop login AdelZ

    Hope this will help others
    Thank you all.