Sql Server: Assign permissions on table TYPE to users
- Posted by Sqltimes
- On July 12, 2014
- 0 Comments
Quick one today:
How do we assign permissions on TABLE TYPEs to user accounts?
Earlier last week, this was a point that needed to be covered in our deployment code. We had permissions script that lists out permissions for each database user on all the objects. Since we recently started adding TABLE TYPE’s, this was never included. Now we are, so how do we assign permissions on TABLE TYPE to user accounts?
1
2
3
4
5
|
-- -- Assign permissions on TABLE TYPE to user account -- GRANT CONTROL ON TYPE::ExternalKeyTableType TO [User_account] GO |
CONTROL permission implies all the other permissions on a TABLE TYPE.
When TABLE TYPE is a parameter in a stored procedure, then you want to grant REFERENCES permission as well.
1
2
3
4
5
|
-- -- Assign REFERENCES permission, if table type is used as parameter in stored procedures -- GRANT REFERENCES ON TYPE::ExternalKeyTableType TO [User_account] GO |
Hope this helps,
0 Comments