Unix Technical Forum

Imitating ownership possible?

This is a discussion on Imitating ownership possible? within the SQL Server forums, part of the Microsoft SQL Server category; --> In order to run SQL queries without having to fully qualify ownership, I know it's necessary to either give ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 02:46 PM
javelin
 
Posts: n/a
Default Imitating ownership possible?

In order to run SQL queries without having to fully qualify ownership,
I know it's necessary to either give ownership to the DBO or log in to
the server as the object owner. The goal I have is to allow entry of a
SQL statement having without logging in as that user and without
having to fully qualify ownership. I know we can USE a different
database easily, so is it also possible to use a different user in
Query Analyzer as the default? That would make life so much easier
than reconnecting as a different user.

Thanks.

J

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 02:46 PM
Plamen Ratchev
 
Posts: n/a
Default Re: Imitating ownership possible?

In SQL Server 2000 you could use the SETUSER command
(http://msdn2.microsoft.com/en-us/lib...0(SQL.80).aspx) to
impersonate the user context for a SQL user account. However, this can only
be used by a sysadmin or db_owner and could not be used for Windows
accounts. In SQL Server 2005 you can use the EXECUTE AS clause to change the
execution context.

Here is a good article about EXECUTE AS:
http://blogs.msdn.com/sqlserverstora...21/642061.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 02:46 PM
javelin
 
Posts: n/a
Default Re: Imitating ownership possible?

Awesome. Thanks for the quick response. I've got a lot of experience
in SQL in other languages, and some in SQL Server, but all the little
tricks of the trade I'm still short on.

Thanks again.

J
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:02 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com