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

RE: Delete Syntax

Status
Not open for further replies.

allyne

MIS
Feb 9, 2001
410
US
Hi everyone,

I'm using SQL 7.0 and need to write a stored procedure that will delete all the information from specific fields in a table. For example, I tried

DELETE
profitability, Unprofitable, MOU%
FROM tblFinalOneLine
(This doesnt' work)

I also Tried

DELETE tblFinalOneLine FROM(SELECT
profitability, Unprofitable, MOU% FROM tblFinalOneLine) AS [60] WHERE
[60].profitability = tblFinalOneLine.profitability and
[60].Unprofitable = tblFinalOneLine.Unprofitable and
[60].MOU% = tblFinalOneLine.MOU%

(This also didn't work. This deletes all the information out of tblFinalOneLine and then selects the fields.)

Can someone tell me what I'm doing wrong?

Thanks for all your help
Cathy

 

Delete is used to remove records or rows of data. If you want to remove data from individual columns you'll need to update the columns.

Setting columns to NULL
Update tblFinalOneLine
Set profitability=null, Unprofitable=null, MOU%=null

If your intent is to remove the columns from the table, you'll use the Alter table command.

ALTER TABLE tblFinalOneLine
DROP COLUMN profitability, Unprofitable, MOU%

Terry Broadbent
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 

Which one worked? Terry Broadbent
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
Update tblFinalOneLine
Set profitability=null, Unprofitable=null, MOU%=null

Thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top