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
 General SQL Server Forums
 New to SQL Server Programming
 need to update table to delete rows

Author  Topic 

smorty44
Yak Posting Veteran

93 Posts

Posted - 2007-10-02 : 10:44:37
what is wrong with this statement?

Update services
Delete
where ticketnum = '0'

error message: incorrect syntax near keyword delete

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2007-10-02 : 10:46:05
delete from services
where ticketnum = '0'
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-10-02 : 11:00:01
You need the table!

DELETE FROM services
WHERE ticketnum = '0'

Jim
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-02 : 16:00:27
I reckon it whouls be

Update services
SET DeleteFlag = 1
where ticketnum = '0'

Go to Top of Page

renu
Starting Member

47 Posts

Posted - 2007-10-03 : 04:42:48
can i know wats ur actual requirement?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-03 : 05:04:31
quote:
Originally posted by smorty44

what is wrong with this statement?

Update services
Delete
where ticketnum = '0'

error message: incorrect syntax near keyword delete


Becuase thats not the correct sql

Learn SQL

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nirene
Yak Posting Veteran

98 Posts

Posted - 2007-10-03 : 05:09:02
Hello Smorty,
If you want to Delete
Delete From Table Where Field='VALUE'
Else If you want to Update
Update Table Set Field='VALUE' Where Field ='VALUE'

Nirene


Go to Top of Page
   

- Advertisement -