Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Give Permission on Schema

Author  Topic 

Muzokh
Starting Member

21 Posts

Posted - 2011-11-25 : 18:54:14
Hi All
I am trying to give access of schema name as HumanResourcs to my newly created user name as han but find an error message
Msg 15151, Level 16, State 1, Line 1
Cannot find the schema 'HumanResources', because it does not exist or you do not have permission.


I did the following steps before issue the above mentioned command.

create login
create user and assign it to login
goto login under security and map the user
issue the command
grant select on schema::HumanResources to han

After this command I received the above mention error.Please suggest

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-25 : 19:05:17
try
select * from information_schema.schemata
and see if your schema is there.
Are you in the correct database?


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Muzokh
Starting Member

21 Posts

Posted - 2011-11-26 : 06:46:49
Thanks for the reply and I didnt find my schema when I executed the provided query but if I navigate to database Adventureworks and then Security and under Security there is a folder name Schema and in schema I can find the name of schema "HumanResources". Please suggest
Go to Top of Page

vikki.seth
Yak Posting Veteran

66 Posts

Posted - 2011-11-26 : 10:42:55
what permissions you have on server?
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-11-26 : 11:30:25
Are you in the correct database

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Muzokh
Starting Member

21 Posts

Posted - 2011-11-27 : 01:31:48
I dont understand the meaning of correct database, actually I am totally new in SQL Server, I just installed SQL Server 2008 Express edition and I am using my default created windows authentication user and I have sysadmin and public server role. Thanks
Go to Top of Page

vikki.seth
Yak Posting Veteran

66 Posts

Posted - 2011-11-27 : 04:10:57
You have run the command under Database context where the object is exist.
Please try this.

Use Adventureworks
grant select on schema::HumanResources to han
Go to Top of Page

Muzokh
Starting Member

21 Posts

Posted - 2011-11-27 : 08:06:02
Thanks you solve my problem, actually i didn't run command under Database context. thank you once again.
Go to Top of Page
   

- Advertisement -