Wednesday, March 21, 2012

MS SQL Server 2000 - Run query as a different user

Can we run some query as a different user working with MS SQL Server 2000?
For example if we connected to the DB in the Enterprise Manager as User1,
can we run some query as User2?
We need to select from a VIEW pulling data from some DB, we can encrypt the
text of this view hiding the target tales and their structure on the target
DB. But since the view works with this DB it should have the permissions to
SELECT from this DB, and that gives the green light to the user to see these
tables in the Enterprise Manager.
It would be nice if we could run the queries inside the view under another
user account and then encrypt the view so that the user will see the view as
it works but should never see the DB tables or the text of the view.
Just D.Of course you can do that, this is one of the benefits of the views.
Example:
Make dbo owner of table employees
Create a view owned by dbo to access some of the fields of employee table
Give permissions to user1 to this view
User1 will be able to access the view but not the employees table
Ben Nevarez, MCDBA, OCP
Database Administrator
"Dmitri Shvetsov" wrote:

> Can we run some query as a different user working with MS SQL Server 2000?
> For example if we connected to the DB in the Enterprise Manager as User1,
> can we run some query as User2?
> We need to select from a VIEW pulling data from some DB, we can encrypt th
e
> text of this view hiding the target tales and their structure on the targe
t
> DB. But since the view works with this DB it should have the permissions t
o
> SELECT from this DB, and that gives the green light to the user to see the
se
> tables in the Enterprise Manager.
> It would be nice if we could run the queries inside the view under another
> user account and then encrypt the view so that the user will see the view
as
> it works but should never see the DB tables or the text of the view.
> Just D.
>
>

No comments:

Post a Comment