Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement timesout

Status
Not open for further replies.

UCF87

Technical User
Feb 13, 2003
44
0
0
US
I am trying to delete 1000s of records and get and SQL timeout error. An example of what I am trying to delete is:
/nnnnyymm I want to delete all of year 03 and month 03.

DELETE FROM ReportIndex WHERE lprRptName LIKE '%%%%%0303'


Thanks for your help in advance.
 
Try to
Create index on that column -- Update statistics ---execute

set nocount on
delete from ReportIndex where right(ltrim(rtrim(lprRptName,4))) = '0303'
 
Now I get the RTRIM requires 1 arguement..
( Did I mention I am new at this.. :cool: )
 
Sorry ,my bad

set nocount on
delete from ReportIndex where right(ltrim(rtrim(lprRptName)),4) = '0303'
 
Still got Time out expired..
 
Try this:

Code:
set rowcount 100

while @@rowcount > 0
begin
DELETE FROM ReportIndex WHERE lprRptName LIKE '%0303'
end

set rowcount 0
 
Consider to change Setting configuration.
execute "sp_configure" will return you sql default setting for many option.Look for "query wait","remote query timeout"....

But I never used it ,just a suggestion.

Remember to change it back after finishing the task
 
dkyle:
Now I get:
Query designer does not support SET STATEMENT SQL Construct.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top