Click here to Skip to main content
15,885,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I need help with SQL User, I need to create 1 view and expose it for 3rd party application.

I have already created SQL view, and have also created User and provide the required permissions using 'select Grant ' statement.

But the problem is that when i connect SQL management studio through this user, i can't see tables (thats good) i can see only view. but when i run query ' select * from (table name)' it provides the result.

How can i provide secure user, so that the ResUser doesn't have any permissions other then accessing the particular view.

Please help. Thanks in advance.

P.S I am new to SQL, so please be kind :)
Posted

1 solution

It seems that you haven't done it in a right way otherwise it must work,
please try the following scripts

USE [master]
GO
CREATE LOGIN [SomeTestUser] WITH PASSWORD=N'TestPAss', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [YourDatabase]
GO
CREATE USER [SomeTestUser] FOR LOGIN [SomeTestUser]
GO


and for giving permission for only select
SQL
USE YourDatabase
GO


GRANT SELECT ON YourView TO SomeTestUser


by following the way if the user wants to select other tables it will receive the following error :

The SELECT permission was denied on the object 


for more info

http://www.blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/giving-only-insert-permissions-to/[^]
 
Share this answer
 
Comments
Amaan23 27-Jun-14 5:54am    
Thanks,

Initially i have used ' GRANT select on' Command but for some strange reason SQL server was playing hide and seek.

After executing this command i logged in with that user i was able to access all the tables..so i thought i was making some mistake.... later when i discuss with my friend. He advice to log off close SQL server management and then log in with new user and check................. and it worked fine...


Thanks for your help. Must appreciated.
Jafarinejadvazifehkhorani 27-Jun-14 8:57am    
good to here that the problem is resolved :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900