CREATE VIEW Permission
I’m mainly writing this as documentation for myself as, in the end, this is the original purpose of this blog, to document SQL Server and new aspects of it that I learn and try.
I’ve always had a little block with regard to this as, for database permissions, I always followed a template in my head:
USE <database> <Give/Take away> <what permission> <On What> <To Whom>
It’s The Little Things That Trip You
With CREATE permissions this isn’t the case; there is a piece of the above template that isn’t needed, and it’s quite easy to see why when I sat down and thought about it.
Specifically, it’s this bit:
I’m granting CREATE permissions; since I haven’t created anything, I can’t grant the permission on anything.
So for CREATE permission, I have to modify my template a bit:
USE <database> <Give/Take away> <what permission> <To Whom>
If I use this now as a template to a GRANT CREATE VIEW, it will work:
USE [localTesting]; GRANT CREATE VIEW TO [testUser];
And it works!