简体   繁体   English

在SSMS 2008中向用户授予权限时复制脚本?

[英]Duplicating Script when granting permissions to a user in SSMS 2008?

In MS SQL 2008 Management Studio, I'm trying to deny certain columns/fields in a table to a specific user. 在MS SQL 2008 Management Studio中,我试图向特定用户拒绝表中的某些列/字段。

To do this, I right click on the DB, expand "Security" and then expand "Users". 为此,我右键单击数据库,展开“安全性”,然后展开“用户”。 Once I've selected the user in question, I then right click and choose "Properties". 选择了有问题的用户后,我然后右键单击并选择“属性”。

The next step is to then choose the page "Securables" and then choose the "Select" Permission. 下一步是选择页面“ Securables”,然后选择“选择”权限。 This is followed by clicking on "Column Permissions" 接下来,单击“列权限”

在此处输入图片说明

Once I've chosen the fields that I want to deny access to for the selected user, I then hit Script, so I can see the T-SQL in a new query window (you can refer to the same image above. The Script is on the top of the window). 选择了要拒绝所选用户访问的字段后,单击“脚本”,这样我就可以在新的查询窗口中看到T-SQL(您可以引用上面的同一幅图像。脚本是在窗口顶部)。

So here's my question: the resulting script seems to duplicate each action twice. 所以这是我的问题:生成的脚本似乎将每个动作重复两次。 For example, here's what it looks like: 例如,这是它的样子:

use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DatabaseConnectionString]) TO [Testing_Login]
GO
use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DBUserName]) TO [Testing_Login]
GO
use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DBPassword]) TO [Testing_Login]
GO
use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DatabaseConnectionString]) TO [Testing_Login]
GO
use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DBUserName]) TO [Testing_Login]
GO
use [master_table]
GO
DENY SELECT ON [dbo].[Table_Main] ([DBPassword]) TO [Testing_Login]
GO

Any idea why it does this? 知道为什么这样做吗? We have a number of tables that I want to match the permissions for and was thinking of using a CURSOR to do this. 我们有许多表要与我的权限匹配,并且正在考虑使用CURSOR来做到这一点。 But I don't know if I should include the above script as is in my procedure or if it's safe to remove the duplicate statements. 但是我不知道是否应该在过程中原样包含上述脚本,或者删除重复的语句是否安全。

Please let me know what you think. 请让我知道你的想法。

Thanks 谢谢

I tried the same in SSMS 2008 R2 and got the same duplicate scripts for each column in the table. 我在SSMS 2008 R2中尝试了相同的操作,并为表中的每一列获得了相同的重复脚本。 It seems to be an issue with SSMS. SSMS似乎是一个问题。 I don't see any reason why you need to include the duplicate script. 我看不出您需要包含重复脚本的任何原因。 I would suggest that you can ignore them. 我建议您可以忽略它们。

You might want to report this issue at Microsoft Connect website. 您可能要在Microsoft Connect网站上报告此问题。

Looks like there was a similar issue report at the website. 网站上似乎有类似的问题报告。 It is still listed as Active. 它仍然被列为活动。

SSMS Script Action produces 2 ALTER DATABASE statement s SSMS脚本操作会生成2条ALTER DATABASE语句

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM