Getting Started with Adobe After Effects - Part 6: Motion Blur

Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Openrowset and sp_who2

Dec 7 2010 12:26AM by Madhivanan   

OPENROWSET function can be used to query on the database exists in different server or query on the stored procedure. Consider that the system procedure sp_who2 gives informations about the current users, sessions, etc.

EXEC sp_who2

But note that the resultset has two columns with the same name SPID. So the openquery function will result to an error if you run this query

select * from OPENROWSET('SQLOLEDB','Server=(local);TRUSTED_CONNECTION=YES;','exec master.dbo.sp_who2')

The error is

Msg 7357, Level 16, State 2, Line 1
Cannot process the object "exec master.dbo.sp_who2". The OLE DB provider "SQLNCLI10" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.

So you need to aware of this that when you run a OPENROWSET function against the procedure whose resultset has same column names will throw an error

Tags: tsql, BRH, SQL Server, #TSQL, #SQLServer,

2 · 40% · 13039


Your Comment

Sign Up or Login to post a comment.

"Openrowset and sp_who2" rated 5 out of 5 by 1 readers
Openrowset and sp_who2 , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]