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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DELETE FROM in a stored procedure

Status
Not open for further replies.

StoneDeCroze

Programmer
Feb 11, 2002
36
GB
MS SQL 7

Has anyone else encountered a problem whereby a stored procedure hangs when you issue a delete statement that for some reason has nothing to delete?

e.g. If I issue the following in a stored procedure (silly example I know ) it hangs:

DELETE FROM sometable WHERE 1=2

I am having to put an IF statement before each one now to check for records.

Just Curious
Peter
 
Nope.
Which service pack are you using?
Is it hanging or table scanning.
Try looking at the query plan.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
SP4

I can issue the command in query analyser and it works fine, just not in an procedure.

The plan is 88% scan, 2% TOP and 10% Table/Delete and 0% delete.

I can live with it, it's annoying is all.

PS - I agree with you about beer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top