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

DELETE SEVERAL ROWS

Status
Not open for further replies.

mireles10

IS-IT--Management
Apr 26, 2004
18
0
0
US
First of all, I want to apologize if this is a duplicate post. I believe I post the question but I could not find it.
Using Sybase 12.5 on Windows Server 2003

I have 2 tables X, and Y
1. use a select statement to find out some values from the X table. Several values are return
A
B
C
..n

Now I write DELETE statement to delete every row

DELETE from Y where columnName = A
DELETE from Y where columnName = A
DELETE from Y where columnName = n

Is there a better way to do this?
Any sample of store procedure StoreProcedure (variable)?

Once the row is deleted, DO I need to run DBCC?
Thank you in advanced.
 
Use the same join in the delete
Code:
delete y
from  x
join  y
  on  x.key=y.key
where ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top