Click here to Skip to main content
15,911,039 members
Home / Discussions / Database
   

Database

 
GeneralDELETE [table] gives syntax error Pin
Vaclav3-Jan-04 12:35
Vaclav3-Jan-04 12:35 
GeneralRe: DELETE [table] gives syntax error Pin
Guillermo Rivero3-Jan-04 17:45
Guillermo Rivero3-Jan-04 17:45 
GeneralRe: DELETE [table] gives syntax error Pin
winay7-Jan-04 2:08
winay7-Jan-04 2:08 
GeneralSql server stored procedure timing out problem Pin
pankajdaga1-Jan-04 10:51
pankajdaga1-Jan-04 10:51 
GeneralRe: Sql server stored procedure timing out problem [modified] Pin
Marek Grzenkowicz2-Jan-04 5:19
Marek Grzenkowicz2-Jan-04 5:19 
GeneralRe: Sql server stored procedure timing out problem Pin
andyharman7-Jan-04 11:09
professionalandyharman7-Jan-04 11:09 
GeneralRe: Sql server stored procedure timing out problem Pin
pankajdaga15-Jan-04 2:05
pankajdaga15-Jan-04 2:05 
GeneralRe: Sql server stored procedure timing out problem Pin
Mike Dimmick8-Jan-04 5:59
Mike Dimmick8-Jan-04 5:59 
Firstly, Query Analyzer never times out - it keeps the connection open until SQL Server finishes responding. I believe osql is the same.

You don't say what API you're using to talk to SQL Server - ADO, OLE DB, ODBC, ... There's probably an option in the API to set a general timeout for communications with the database. You could extend this for a long-running query.

You should become familiar with the set-based versions of DELETE. The DELETE statement is very powerful and can handle any condition in the WHERE clause, not just equalities. I would rewrite your procedure as
CREATE PROCEDURE DeleteTicketData
@ticketNum int AS
 
declare @testVorgangID int
 
-- delete errors
DELETE FROM TestVorgangEinleseFehler_T WHERE TicketNumber = @ticketNum
 
Select @testVorgangID = TestVorgangID from TestTickets_T WHERE TestTicketID = @ticketNum
 
IF (@testVorgangID IS NOT NULL)
BEGIN
   DELETE FROM TestVorgaenge_T WHERE TestVorgangID = @testVorgangID
 
   -- You could create a temporary table or table variable
   -- for the SELECT part here
   DELETE FROM TestAktionen_T WHERE TestID IN
      ( SELECT TestID FROM Tests_T WHERE TestVorgangID = @testVorgangID )
   DELETE FROM TestDSPACETable_T WHERE TestID IN
      ( SELECT TestID FROM Tests_T WHERE TestVorgangID = @testVorgangID )
   -- repeat for other tables
 
   DELETE FROM Tests_T WHERE TestVorgangID = @testVorgangID
END
 
GO
In general, set-based operations run far faster than cursor-based operations.
GeneralRe: Sql server stored procedure timing out problem Pin
pankajdaga15-Jan-04 1:40
pankajdaga15-Jan-04 1:40 
GeneralSQL to FOX Pin
Majid Shahabfar31-Dec-03 6:09
Majid Shahabfar31-Dec-03 6:09 
GeneralRe: SQL to FOX Pin
Mazdak31-Dec-03 19:06
Mazdak31-Dec-03 19:06 
GeneralRunning SQL in Developer Studio Pin
Steve Schaneville31-Dec-03 4:23
professionalSteve Schaneville31-Dec-03 4:23 
Generalopen UDL Dialog at runtime Pin
Itanium30-Dec-03 1:59
Itanium30-Dec-03 1:59 
GeneralRe: open UDL Dialog at runtime Pin
Mazdak31-Dec-03 19:26
Mazdak31-Dec-03 19:26 
GeneralRe: open UDL Dialog at runtime Pin
Itanium31-Dec-03 21:45
Itanium31-Dec-03 21:45 
GeneralRe: open UDL Dialog at runtime Pin
Mazdak31-Dec-03 22:01
Mazdak31-Dec-03 22:01 
GeneralRe: open UDL Dialog at runtime Pin
Heath Stewart3-Jan-04 18:49
protectorHeath Stewart3-Jan-04 18:49 
GeneralRe: open UDL Dialog at runtime Pin
Richard Deeming9-Jan-04 6:29
mveRichard Deeming9-Jan-04 6:29 
Generalstored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz26-Dec-03 21:44
Marek Grzenkowicz26-Dec-03 21:44 
GeneralRe: stored procedures - avoiding recompilations Pin
Chris Meech5-Jan-04 4:57
Chris Meech5-Jan-04 4:57 
GeneralRe: stored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz5-Jan-04 5:49
Marek Grzenkowicz5-Jan-04 5:49 
GeneralRe: stored procedures - avoiding recompilations Pin
Mike Dimmick5-Jan-04 5:36
Mike Dimmick5-Jan-04 5:36 
GeneralRe: stored procedures - avoiding recompilations [modified] Pin
Marek Grzenkowicz5-Jan-04 6:21
Marek Grzenkowicz5-Jan-04 6:21 
GeneralData structure to describe HTML table Pin
Anonymous26-Dec-03 20:26
Anonymous26-Dec-03 20:26 
GeneralRe: Data structure to describe HTML table Pin
Colin Angus Mackay27-Dec-03 6:48
Colin Angus Mackay27-Dec-03 6:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.