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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 If Not Exists and Grant permissions

Author  Topic 

spthomas
Starting Member

14 Posts

Posted - 2010-12-16 : 11:55:52
I need to create several production scripts to alter tables, and part of that is GRANTing permissions. The script is rerunnable; we use If Not Exists on the Table Crate and Alters, so if it's already there it doesn't try again. But the GRANT statements have me stumped. How do I specify that, if this group doesn't have permission on this table, GRANT it, otherwise do nothing?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-12-16 : 13:44:07
Just GRANT it. Even if they already have permission, it won't cause an error to grant it again.

Just as quick to (re)grant the permission as it is to check.
Go to Top of Page
   

- Advertisement -