向用户提供用户权限,仅访问1个视图

编程入门 行业动态 更新时间:2024-10-25 23:32:08
本文介绍了向用户提供用户权限,仅访问1个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的朋友们, 我需要SQL用户的帮助,我需要创建1个视图并将其暴露给第三方应用程序。 我已经创建了SQL视图,并且还使用'select Grant'语句创建了User并提供了所需的权限。 但问题是,当我通过这个用户连接SQL管理工作室时,我看不到表(那很好)我只能看到视图。但是当我运行查询'select * from(table name)'时它会提供结果。 我如何提供安全用户,以便ResUser没有访问特定视图以外的任何权限。 请帮助。在此先感谢。 PS我是SQL的新手,所以请善待:)

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 :)

推荐答案

看来你没有以正确的方式完成它,否则它必须工作, 请尝试以下脚本 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

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

更多信息 www.blogs.lessthandot/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/giving-only-insert-permissions -to / [ ^ ]

更多推荐

向用户提供用户权限,仅访问1个视图

本文发布于:2023-10-30 03:59:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1541691.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户提供   视图   用户权限

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!