Unix Technical Forum

Using Openquery Without Returning Resultset

This is a discussion on Using Openquery Without Returning Resultset within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello, Quick, and possibly strange, question. I am doing some work testing the running time of some dynamic SQL ...


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 02-28-2008, 07:03 PM
Phil Sandler
 
Posts: n/a
Default Using Openquery Without Returning Resultset

Hello,

Quick, and possibly strange, question.

I am doing some work testing the running time of some dynamic SQL
statements on a remote machine. What I would like to do is execute
the SQL on the remote machine, without returning the result set to the
calling machine (this would skew the results, as my connection to the
remote machine is rather slow).

I believe SET ROWCOUNT 0 would work in principle, but the
documentation says:
"Causes Microsoft® SQL Server™ to stop processing the query after the
specified number of rows are returned."

I don't want processing to stop until all the records have been
identified. I also don't know if "SET ROWCOUNT" works with openquery
(althought a non-openquery solution would also be acceptable).

The code will be running in a stored procedure, if that matters.

Any input would be much appreciated.


Phil
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:06 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Using Openquery Without Returning Resultset

Phil Sandler (psandler70@hotmail.com) writes:
> I am doing some work testing the running time of some dynamic SQL
> statements on a remote machine. What I would like to do is execute
> the SQL on the remote machine, without returning the result set to the
> calling machine (this would skew the results, as my connection to the
> remote machine is rather slow).
>
> I believe SET ROWCOUNT 0 would work in principle, but the
> documentation says:
> "Causes Microsoft® SQL Server™ to stop processing the query after the
> specified number of rows are returned."
>
> I don't want processing to stop until all the records have been
> identified. I also don't know if "SET ROWCOUNT" works with openquery
> (althought a non-openquery solution would also be acceptable).


And SET ROWCOUNT 0 means that all rows should be returned.

The best is probably to insert the result from the dynamic SQL in a
table, temp table or permanent. True, this will add the cost to
write to disk, but it's probably less skewed than getting data over
a network link.

Using temp tables with OPENQUERY is not completely trivial, because
the SQLOLEDB provider does some tricks behind your back. I have some
discussion about this on
http://www.algonet.se/~sommar/share_data.html#OPENQUERY.


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
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 10:00 PM.


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