Simon's SQL

SQL,DBA,tuning,Trouble Shooting,Performance

permission test.(impersonate)

Posted by Simon Cho on 11/03/2011

select SUSER_ID(), SUSER_NAME()
go
select * from server_A.master.dbo.sysobjects
go

(1 row(s) affected)
Msg 18452, Level 14, State 1, Line 0
Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.

execute as login = ‘sql_admin’  –who has the permission to login the server.
go
select SUSER_ID(), SUSER_NAME()
go
select * from server_A.master.dbo.sysobjects
go

(1 row(s) affected)

(1277 row(s) affected)

revert;
go
select SUSER_ID(), SUSER_NAME()
go

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: