Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Connection with SQL Server generate "Timeout expired"


Hi All,

When I execute the following query

"DELETE FROM Cst_Acessorios WHERE (CodInterno_IV_Acessorio IN ('0','N')
AND Qtd_Acessorio = 0) OR (CodZFoccus_IV = '0' AND CodInterno_IV =
'0')"

in a SQL Server database a receive the error message "Timeout
Expired".

I already changed the parameters to the OLEDB connection:
- Connect Timeout = 3000
- Connection Lifetime = 600

But I continue receiving the same error message.

Anybody can help me?

Best regards,
JV.


--
joaovtt
------------------------------------------------------------------------
joaovtt's Profile: http://www.excelforum.com/member.php...o&userid=24286
View this thread: http://www.excelforum.com/showthread...hreadid=381734

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Connection with SQL Server generate "Timeout expired"

Hi JV,

joaovtt wrote:
When I execute the following query

"DELETE FROM Cst_Acessorios WHERE (CodInterno_IV_Acessorio IN
('0','N') AND Qtd_Acessorio = 0) OR (CodZFoccus_IV = '0' AND
CodInterno_IV = '0')"

in a SQL Server database a receive the error message "Timeout
Expired".

I already changed the parameters to the OLEDB connection:
- Connect Timeout = 3000
- Connection Lifetime = 600

But I continue receiving the same error message.


If you execute this statement using Query Analyzer or a similar tool, how
long does it take to execute?

How are you executing the statement in VBA? Using the Connection object or
the Command object?

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Connection with SQL Server generate "Timeout expired"


hi Jake,

if I use Query Analyzer, this query take around 3 or 4 minutes.


I'm using the following code:

Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=SQLOLEDB.1;Connect Timeout=0;Command Timeout=0;Data
Source=" & server & ";Initial Catalog=" & dataBase & ";User Id=" &
userName & ";password=" & uPassword & ""
con.Execute "DELETE FROM Cst_Acessorios WHERE (CodInterno_IV_Acessorio
IN ('0','N') AND Qtd_Acessorio = 0) OR (CodZFoccus_IV = '0' AND
CodInterno_IV = '0');"


best regards,
JV


--
joaovtt
------------------------------------------------------------------------
joaovtt's Profile: http://www.excelforum.com/member.php...o&userid=24286
View this thread: http://www.excelforum.com/showthread...hreadid=381734

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Connection with SQL Server generate "Timeout expired"

Hi JV,

I have never attempted to use "Command Timeout" in the connection string
itself. Maybe it's not supported? Either way, you can add this code before
invoking the Execute method:

con.CommandTimeout = 0

That should allow the query to take as long as it needs to.

That said, 3 to 4 minutes for a query as simple as this seems like a long
time. How many records are in your table? What types of fields are those
that are referenced in your WHERE clause? Are there indexes on those
fields?

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


joaovtt wrote:
hi Jake,

if I use Query Analyzer, this query take around 3 or 4 minutes.


I'm using the following code:

Dim con As Object
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=SQLOLEDB.1;Connect Timeout=0;Command Timeout=0;Data
Source=" & server & ";Initial Catalog=" & dataBase & ";User Id=" &
userName & ";password=" & uPassword & ""
con.Execute "DELETE FROM Cst_Acessorios WHERE (CodInterno_IV_Acessorio
IN ('0','N') AND Qtd_Acessorio = 0) OR (CodZFoccus_IV = '0' AND
CodInterno_IV = '0');"


best regards,
JV


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 233
Default Connection with SQL Server generate "Timeout expired"

Maybe start using a T-SQL stored proc for this?

Also in Query Analyzer run the optimizer to see if you missed any
indexes. Either your SQL server is underperforming or not fully
optimized.

DM Unseen



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Connection with SQL Server generate "Timeout expired"


I'm sorry, but how can I call a stored procedure from a excel macro?


My table has up to 4 million records... At the moment, I'm not using
any indexes because it's a table for staging in a ETL process. If I use
indexes any time I truncate and insert in this table, these indexes will
be update?


--
joaovtt
------------------------------------------------------------------------
joaovtt's Profile: http://www.excelforum.com/member.php...o&userid=24286
View this thread: http://www.excelforum.com/showthread...hreadid=381734

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maintain lowest value in an "external connection" cell Nick Ng[_2_] Excel Worksheet Functions 0 March 30th 10 11:33 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
find expired dates =IF((E11-TODAY()<0), "EXPIRED", "OK") Jo Excel Worksheet Functions 1 June 5th 07 12:42 AM
"WinForm Application" to act as "RTD Server" using .Net mduraidi Excel Discussion (Misc queries) 0 March 30th 06 01:01 PM
Connection with SQL Server - "time exceed" joaovtt[_2_] Excel Programming 1 June 23rd 05 08:51 PM


All times are GMT +1. The time now is 03:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"