Link to home
Start Free TrialLog in
Avatar of madmare
madmareFlag for Israel

asked on

sql server 2008 how do I create view by other user

Hi All,
 How do I in Sql server create a View / Table by other user ?

Avatar of Koen Van Wielink
Koen Van Wielink
Flag of Netherlands image

Can you please clarify what you mean with "by other user"?
Avatar of madmare


my username in the server is jmua123
I have another username which is yuv123

I need a syntax write a create command which be executed as yuv123 & NOT by me jmua123

so yuv123 wil be the creator & owner etc.. of this table
Avatar of madmare


something like execute command as other user
Could you clarify why you need to do this? Also, if this other user has rights to create and own a view, why don't you just login as this user and run the command under that login?
Avatar of madmare


I cannot login by the second username name because the permissions are windows authentications

In addition we connect the sql server via Citrix

the second user doesn't have a citrix account, so it's a little bit difficult to login as the second user
Avatar of Haris Dulic
If you wnat other user to use or be able to select from view you can grant him select by using this
GRANT SELECT ON DB_NAME.VIEW_NAME TO [your_domain_name\yuv123];

Open in new window

and if you wand that user to be able to give grants to other users you just add WITH GRANT OPTION after his username.

And since you mentioned it is domain user you need to put his username in following form [domain\user] i.e. [your_domain_name\yuv123]
Avatar of madmare


How do I make him the owner of the table ?

not only to give him select permission
use this :

EXEC sp_changeobjectowner 'view_name', 'your_domain_name\yuv123'

Open in new window

Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial