views:

23

answers:

0

Hi

Following advice to my previous post (thanks fellas, it works a treat), I've implemented a certificate in the master db with VIEW ANY DEFINITION permissions and used this to sign my stored procs so they can access Information_schema.

However, my stored procs also make use of dynamic sql. Is it possible to create a certificate, grant select permissions to the underlying tables on this certificate and use this as well? I know I can create a user from a certificate. However, when I tried this and attempted to test it using Execute as user = 'username' I receive the following error:

Cannot execute as the database principal because the principal "username" does not exist, this type of principal cannot be impersonated, or you do not have permission.

Can anyone offer me advice on how I might achieve this?