Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 delete sql statment

Author  Topic 

akas
Starting Member

42 Posts

Posted - 2009-03-09 : 15:41:34
hi guys,

this is simple delete statement but still its not working..i want to delete the value of the field review for this particular itemnmbr from this table but its not deleting..is anything wrong in my statement?

Thanks for ur help.

delete review
from myreaderreview
where review_date = '2000-04-02 18:40:31.000' and itemnmbr = '2724'

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-09 : 15:47:25
Delete doesn't work that way...

Use Update

Update myreaderreview set review = '' where review_date = '2000-04-02 18:40:31.000' and itemnmbr = '2724'
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-03-09 : 15:58:12
dependign on which table is parent...maybe
DELETE FROM review
WHERE ID IN
(SELECT ID
FROM myreaderreview
review_date = '2000-04-02 18:40:31.000' and itemnmbr = '2724');

Go to Top of Page

Skorch
Constraint Violating Yak Guru

300 Posts

Posted - 2009-03-09 : 17:39:00
Your only problem that I see is you're trying to specify a column to delete. I'm assuming you're trying to delete the entire row, so the syntax would just be like this:

delete from myreaderreview
where review_date = '2000-04-02 18:40:31.000' and itemnmbr = '2724'

Some days you're the dog, and some days you're the fire hydrant.
Go to Top of Page
   

- Advertisement -