August 5, 2005 at 8:21 am
>>>>
Select * into #T1
from Openrowset('SQLOLEDB','Trusted_connection=yes;Data Source=YOURSERVER','exec sp_who') dt
select * from #T1
drop table #T1
<<<<<
Noeld, I must be missing something with this code. When I run the query it executes sp_who on the server to which QA is connected, regardless of the server name I specify in SOURCE=
I took a look in BOL but don't see why this doesn't work. Any thoughts?
Thanks
August 5, 2005 at 8:29 am
Do you have access to those servers?
Did you try using the sa account instead of trusted?
Noeld I'm getting close... I was only missing the data source this time .
August 5, 2005 at 8:33 am
That is correct!! (The code was using Windows integrated security) The problem is that if you want to be able to switch "servers" then you need to:
1. Setup account delegation with Kerberos (which not everyone can)
2. Use SQL authentication
so following the second suggestion you can try:
Openrowset('SQLOLEDB','Server=SERVERNAME;UID=xx;PWD=nn;Database=dd','exec sp_who')
* Noel
August 5, 2005 at 8:41 am
>>>
Openrowset('SQLOLEDB','Server=SERVERNAME;UID=xx;PWD=nn;Database=dd','exec sp_who')
<<<
That did it. Thanks.
August 5, 2005 at 8:55 am
You are welcome!
* Noel
August 5, 2005 at 9:53 am
Hi ,
Thanx to neold it worked exactly what i needed.
Thanx to Remi,johnson and everybody on this post.
from
killer
August 5, 2005 at 9:59 am
HTH.
August 19, 2005 at 12:30 pm
Have you tried a "select into" statement? Seems to work well. All you have to give is a table name. For subsequent running of a select into statement I would first run a t-sql statement that looks in the sysobjects table of the db you're going to store the temp table into and drop the table if it exists.
August 19, 2005 at 12:36 pm
That's select into with a stored proc... not select .
Select *
into #T1
from Openrowset('SQLOLEDB','Trusted_connection=yes;Data Source=YOURSERVER','exec sp_who') dt
select * from #T1
drop table #T1
August 20, 2005 at 4:16 am
Hi Tim,
Select * into work with table
i needed with stored procedure . This help me in keeping old data copied from dbcc and extended stored procedure.
Again thanx to neol and Remi
from
Killer
August 1, 2007 at 6:41 am
Hello,
i have a question on this. Maybe you can help...
Following SQL works fine:
Select
*
from
Openquery(siebeldb, 'Exec sp_help')
But when i try it on sp_helpdb:
Select
*
from
Openquery(siebeldb, 'Exec sp_helpdb')
i get following error:
Msg 7357, Level 16, State 2, Line 1
Cannot process the object "Exec sp_helpdb". The OLE DB provider "SQLNCLI" for linked server "siebeldb" indicates that either the object has no columns or the current user does not have permissions on that object.
Why this? I have the same permission on this object?
any idea on that?
regards
andreas
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply