In MS SQL 2008 Management Studio, I’m trying to deny certain columns/fields in a table to a specific user.
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. 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).
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. 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. It seems to be an issue with 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.
Looks like there was a similar issue report at the website. It is still listed as Active.
SSMS Script Action produces 2 ALTER DATABASE statements