|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem -- not using current login to search for owner of tablesI'm having a problem with SQL Server 2000. I have created a user
called "abc". I created a slew of tables, procs, etc. When I look in Enterprise Manager, I see they are all owned by "abc". I log into Query Analyzer as "abc" and run a "select" statement and get an "Invalid object name" error. I qualify the name with "abc" and the query executes fine. However, according to all the documentation, it should search for an object owned by the current user, and sinced I'm logged on as the owner, it should have found the object without qualification. Anybody have any ideas what the problem might be? Thanks in advance. BOL says
Database Owner (dbo) The dbo is a user that has implied permissions to perform all activities in the database. Any member of the sysadmin fixed server role who uses a database is mapped to the special user inside each database called dbo. Also, any object created by any member of the sysadmin fixed server role belongs to dbo automatically. For example, if user Andrew is a member of the sysadmin fixed server role and creates a table T1, T1 belongs to dbo and is qualified as dbo.T1, not as Andrew.T1. Conversely, if Andrew is not a member of the sysadmin fixed server role but is a member only of the db_owner fixed database role and creates a table T1, T1 belongs to Andrew and is qualified as Andrew.T1. The table belongs to Andrew because he did not qualify the table as dbo.T1. The dbo user cannot be deleted and is always present in every database. Only objects created by members of the sysadmin fixed server role (or by the dbo user) belong to dbo. Objects created by any other user who is not also a member of the sysadmin fixed server role (including members of the db_owner fixed database role): a.. Belong to the user creating the object, not dbo. b.. Are qualified with the name of the user who created the object. <orwellnel***@usa.com> wrote in message Show quote news:1129811646.319075.38540@g49g2000cwa.googlegroups.com... > I'm having a problem with SQL Server 2000. I have created a user > called "abc". I created a slew of tables, procs, etc. When I look in > Enterprise Manager, I see they are all owned by "abc". > > I log into Query Analyzer as "abc" and run a "select" statement and get > an "Invalid object name" error. I qualify the name with "abc" and the > query executes fine. However, according to all the documentation, it > should search for an object owned by the current user, and sinced I'm > logged on as the owner, it should have found the object without > qualification. > > Anybody have any ideas what the problem might be? Thanks in advance. > > However, according to all the documentation, it Try running SELECT USER to determine the user identity for the current > should search for an object owned by the current user, and sinced I'm > logged on as the owner, it should have found the object without > qualification. session. If this returns other than 'abc', you'll need to explicitly qualify the object names. Note that the 'abc' login will be mapped to the 'dbo' user when the login is the database owner or a sysadmin role member. Another possibility is that the 'abc' login is mapped to a user other than 'abc'. -- Show quoteHope this helps. Dan Guzman SQL Server MVP <orwellnel***@usa.com> wrote in message news:1129811646.319075.38540@g49g2000cwa.googlegroups.com... > I'm having a problem with SQL Server 2000. I have created a user > called "abc". I created a slew of tables, procs, etc. When I look in > Enterprise Manager, I see they are all owned by "abc". > > I log into Query Analyzer as "abc" and run a "select" statement and get > an "Invalid object name" error. I qualify the name with "abc" and the > query executes fine. However, according to all the documentation, it > should search for an object owned by the current user, and sinced I'm > logged on as the owner, it should have found the object without > qualification. > > Anybody have any ideas what the problem might be? Thanks in advance. > >>Note that the 'abc' login will be mapped to the 'dbo' user when the login is the database owner or a sysadmin role member. ****That was it -- the user was set up as a sysadmin. However, when I tried to change it, I get a few problems -- - The user is defined within the DB, as "dbowner" role. - If I remove the "sysadmin" from the user's profile, the user no longer has authority to the DB. - If I go into the profile, and try to assign database access rights, I get a "Error 21002: [SQL-DMO] User already exists" error. - If I try to remove the user within the DB, then it gives me another error, saying it cannot remove the user from the DB because it owns objects. Am I screwed? Do I need to completely drop everything and try to rebuild from scratch? Or is there something else I can do to get the authority working? These symptoms may be due to the 'abc' login not being associated with the
'abc' user in the database. This might occur if the database was restored or attached from another server. Try running sp_helplogins to determine the login/user mapping for this login and sp_helpuser for the user/login mapping: USE MyDatabase EXEC sp_helplogins 'abc' EXEC sp_helpuser 'abc' You can change the mapping for the 'abc' user using sp_change_users_login. See the Books Online for more information. -- Show quoteHope this helps. Dan Guzman SQL Server MVP <orwellnel***@usa.com> wrote in message news:1129843731.421280.156660@g14g2000cwa.googlegroups.com... >>>Note that the 'abc' login will be mapped to the 'dbo' user when the login >>>is the database owner or a sysadmin role member. > > **** > > That was it -- the user was set up as a sysadmin. However, when I > tried to change it, I get a few problems -- > > - The user is defined within the DB, as "dbowner" role. > - If I remove the "sysadmin" from the user's profile, the user no > longer has authority to the DB. > - If I go into the profile, and try to assign database access rights, I > get a "Error 21002: [SQL-DMO] User already exists" error. > - If I try to remove the user within the DB, then it gives me another > error, saying it cannot remove the user from the DB because it owns > objects. > > Am I screwed? Do I need to completely drop everything and try to > rebuild from scratch? Or is there something else I can do to get the > authority working? > |
|||||||||||||||||||||||