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 ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Koen Van WielinkBusiness Intelligence SpecialistCommented:
Can you please clarify what you mean with "by other user"?
madmareAuthor Commented:
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
madmareAuthor Commented:
something like execute command as other user
10 Holiday Gifts Perfect for Your Favorite Geeks

Still have some holiday shopping to do for the geeks in your life? While toys, clothing, games, and gift cards are still viable options for your friends and family, there’s more reason than ever to consider gadgets and software.

Koen Van WielinkBusiness Intelligence SpecialistCommented:
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?
madmareAuthor Commented:
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
Haris DulicIT ArchitectCommented:
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]
madmareAuthor Commented:
How do I make him the owner of the table ?

not only to give him select permission
Haris DulicIT ArchitectCommented:
use this :

EXEC sp_changeobjectowner 'view_name', 'your_domain_name\yuv123'

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
I wrote 3 articles about Views. I recommend you to read my 2nd article so it can clarifies you about Views..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.