1

I need to query a proprietary database where the software vendor has set tight permissions on each schema (one username per schema), and each schema-user is only allowed to read from their own schema.

I now need to run a query across multiple schemas. Is it possible to run a single query against multiple user accounts? Something like EXEC AS USER 'A' AND 'B'?

Obviously the correct method is to create a user with all required permissions, but I am running the query from a stand-alone utility and will not have admin privileges on my future clients' instances.

asked Feb 21, 2012 at 14:34
0

3 Answers 3

3

No, you can't.

You could create user C that has permissions of A and B...

answered Feb 21, 2012 at 14:37
0
2

Another suggestion that you can look into is SQL ownership chains.

With ownership chaining, a stored procedure can be created with permissions to the accessed objects. Then a user can be granted execute permission to the SP without needing explicit permission on the accessed objects.

answered Feb 22, 2012 at 6:02
0
1

You can use a different approach, namely code signing. Through code signing a procedure can be granted elevated permissions, in your case you can sign the procedure with a certificate and then create a certificate derived user and add this user to the db_owner role. This way the procedure gets de-facto dbo privileges. You would need a separate procedure for each action performed by your application.

Of course deploying these procedures, certificates, certificate derived users and signatures require elevated privileges to start with, but this is usually resolved by requiring the application setup to run in an elevated context.

answered Feb 21, 2012 at 16:06
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.