 |
|
 |
|
Next: How to set the xp_cmdshell so that it will not ov..
|
| Author |
Message |
External

Since: Jul 26, 2008 Posts: 1
|
(Msg. 1) Posted: Sat Jul 26, 2008 10:19 pm
Post subject: OPENQUERY with stored procedures error Archived from groups: microsoft>public>sqlserver>programming (more info?)
|
|
|
I am currently using SQL Server 2005 Express Edition and SSMSE. I have
developed a unit testing suite for my stored procedures. The way it works
is, all of my tests (stored procedures on the database that call the actual
stored procedures to determine if they return the correct output) are
executed and their results are stored in a table to be queried from. So
basically I write a test and then I write the stored procedure that the test
will verify. Well some of my stored procs are simple select statements. To
verify these, I need a way to call the stored procedure from within my test
stored procedure and iterate through the returned recordset. I use a call to
open query for this:
SELECT @Count = count(*) FROM OPENQUERY(LOCALSERVER, 'EXEC
MyDb..mysp_SPToTest')
Now if I just execute this statement, their are no problems and @Count is
equal to the correct value. However, when my test suite is run it goes
something like this:
EXEC Run (stored procedure) --> For every test, EXEC Test (stored procedure)
--> EXEC SPToTest (stored procedure)
The call to OPENQUERY is made from within the 'EXEC Test' stored procedure
and I am given an error of:
OLE DB provider "SQLNCLI" for linked server "LOCALSERVER" returned message
"Query timeout expired".
Msg 7399, Level 16, State 1, Procedure ut_Names_GetAll, Line 12
The OLE DB provider "SQLNCLI" for linked server "LOCALSERVER" reported an
error. Execution terminated by the provider because a resource limit was
reached.
Msg 7320, Level 16, State 2, Procedure ut_Names_GetAll, Line 12
Cannot execute the query "EXEC TMF_PMS..tmfsp_GetAllNames" against OLE DB
provider "SQLNCLI" for linked server "LOCALSERVER".
A few more facts:
LOCALSERVER is set as:
EXEC sp_addlinkedserver
@server='LOCALSERVER',
@srvproduct='',
@provider='SQLNCLI',
@datasrc='.\SQLEXPRESS'
EXEC sp_serveroption 'LOCALSERVER', 'connect timeout', '10'
EXEC sp_serveroption 'LOCALSERVER', 'query timeout', '10'
EXEC sp_serveroption 'LOCALSERVER', 'collation compatible', 'true'
If I leave the query timeout to '0' then it just keeps the query stalled
until the 10 minute default query times out. I found on the web an article
saying their may be trouble if port 1433 is blocked by your firewall, however
I have unblocked this at every level of my firewall that is available, so
this cannot be my problem. How do I get around this query timeout or what
may be causing it? >> Stay informed about: OPENQUERY with stored procedures error |
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2003 Posts: 1744
|
(Msg. 2) Posted: Sun Jul 27, 2008 9:38 am
Post subject: Re: OPENQUERY with stored procedures error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Hi
http://support.microsoft.com/kb/314530
http://support.microsoft.com/kb/270119
"Pr09" wrote in message
>I am currently using SQL Server 2005 Express Edition and SSMSE. I have
> developed a unit testing suite for my stored procedures. The way it works
> is, all of my tests (stored procedures on the database that call the
> actual
> stored procedures to determine if they return the correct output) are
> executed and their results are stored in a table to be queried from. So
> basically I write a test and then I write the stored procedure that the
> test
> will verify. Well some of my stored procs are simple select statements.
> To
> verify these, I need a way to call the stored procedure from within my
> test
> stored procedure and iterate through the returned recordset. I use a call
> to
> open query for this:
>
> SELECT @Count = count(*) FROM OPENQUERY(LOCALSERVER, 'EXEC
> MyDb..mysp_SPToTest')
>
> Now if I just execute this statement, their are no problems and @Count is
> equal to the correct value. However, when my test suite is run it goes
> something like this:
>
> EXEC Run (stored procedure) --> For every test, EXEC Test (stored
> procedure)
> --> EXEC SPToTest (stored procedure)
>
> The call to OPENQUERY is made from within the 'EXEC Test' stored procedure
> and I am given an error of:
>
> OLE DB provider "SQLNCLI" for linked server "LOCALSERVER" returned message
> "Query timeout expired".
> Msg 7399, Level 16, State 1, Procedure ut_Names_GetAll, Line 12
> The OLE DB provider "SQLNCLI" for linked server "LOCALSERVER" reported an
> error. Execution terminated by the provider because a resource limit was
> reached.
> Msg 7320, Level 16, State 2, Procedure ut_Names_GetAll, Line 12
> Cannot execute the query "EXEC TMF_PMS..tmfsp_GetAllNames" against OLE DB
> provider "SQLNCLI" for linked server "LOCALSERVER".
>
> A few more facts:
> LOCALSERVER is set as:
>
> EXEC sp_addlinkedserver
> @server='LOCALSERVER',
> @srvproduct='',
> @provider='SQLNCLI',
> @datasrc='.\SQLEXPRESS'
> EXEC sp_serveroption 'LOCALSERVER', 'connect timeout', '10'
> EXEC sp_serveroption 'LOCALSERVER', 'query timeout', '10'
> EXEC sp_serveroption 'LOCALSERVER', 'collation compatible', 'true'
>
> If I leave the query timeout to '0' then it just keeps the query stalled
> until the 10 minute default query times out. I found on the web an
> article
> saying their may be trouble if port 1433 is blocked by your firewall,
> however
> I have unblocked this at every level of my firewall that is available, so
> this cannot be my problem. How do I get around this query timeout or what
> may be causing it? >> Stay informed about: OPENQUERY with stored procedures error |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 1007
|
(Msg. 3) Posted: Sun Jul 27, 2008 2:07 pm
Post subject: Re: OPENQUERY with stored procedures error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: May 30, 2004 Posts: 2061
|
(Msg. 4) Posted: Sun Jul 27, 2008 3:01 pm
Post subject: Re: OPENQUERY with stored procedures error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Pr09 (Pr09@discussions.microsoft.com) writes:
> I am currently using SQL Server 2005 Express Edition and SSMSE. I have
> developed a unit testing suite for my stored procedures. The way it
> works is, all of my tests (stored procedures on the database that call
> the actual stored procedures to determine if they return the correct
> output) are executed and their results are stored in a table to be
> queried from. So basically I write a test and then I write the stored
> procedure that the test will verify. Well some of my stored procs are
> simple select statements. To verify these, I need a way to call the
> stored procedure from within my test stored procedure and iterate
> through the returned recordset. I use a call to open query for this:
I agree with Plamen, do this client-side. OPENQUERY is going to buy you
a lot more troubles, you ain't seen nothing yet!
--
Erland Sommarskog, SQL Server MVP, esquel RemoveThis @sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx >> Stay informed about: OPENQUERY with stored procedures error |
|
| Back to top |
|
 |  |
| Related Topics: | Libraries of Stored Procedures and Error Handling - I am trying to design a high quality set of library stored procedures in MSSQL 2005. My issue at hand is I don't know the best way to design error handling. For example, suppose I have the following stack of executed stored procedures in TSQ: Client..
stored procedures - Is it possible, if so, how do you exec a SP and have the results from it be usable so it could be joined into another table? Even if I have to store the results into a temp table first is fine.....
Paging with Stored Procedures - I have been browsing the newsgroups trying to find a good solution for this problem. I have a resultset and I need to show that information in pages. I also need to have this sorted by a specific column (Date for example) I found the following solutio...
Optimizing Stored procedures -
Scheduling stored procedures - I've written a stored procedure on my SQL server that deletes records older than 7 days from a table. My SQL server the procedure resides on a shared hosted environment. I now want to schedule the procedure daily, which i attempt to setup through th... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|