Conditional delete from query in sql enterprise manager

Trying to delete rows for the condition below in sql enterprise manager does nothing but tell me the query was run.

delete from downloads
where id < 5000
and filesize < 200000

I want to delete all rows where the id is less than 5000 and the filesize is less than 200000. There are no other conditions. No triggers I can see. Nothing unusual. If I remove the conitions and simply run "delete from downloads" the rows are deleted, except I do get a timeout.

So, what might I be doing wrong and how can I correct it?

 - Georgia

RollinNowAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
dduserConnect With a Mentor Commented:
Select * from downloads
where id < 5000
and filesize < 200000

How many rows this returns???

Regards,

dduser
0
 
Aneesh RetnakaranConnect With a Mentor Database AdministratorCommented:
Did you try it from Query analyser ? the problem with the EM is that it will create a duplicate of that table and try to delete the data from there,  so this is not advisable.
0
 
RollinNowAuthor Commented:
Yes I did, that is, just now, first time. I was told there were 0 rows affected. I'm sure the id and filesize values are correct.

Also, is there a timeout statement I can use in the query?
0
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
>I want to delete all rows where the id is less than 5000 and the filesize is less than 200000.
do you mean to delete all the rows that have id 5000    and delete all the rows  that have filesize less than 200000, or do you need both conditions at the same time?
if you need either condition, then use OR:
delete from downloads
where ( id < 5000 or filesize < 200000 )

resp:
delete from downloads
where id < 5000

delete from downloads
where filesize < 200000


0
 
RollinNowAuthor Commented:
Looks like the rows were all above 200000 filesize. Silly me!

Thanks for holding my hand!

 - Georgia
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.