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
 Stored procedure using Delete row

Author  Topic 

Ernie57
Starting Member

27 Posts

Posted - 2006-05-31 : 10:03:42
I want to delete some rows in a table using a Stored procedure. I am using MS sql 2000 using Enterprise manager. I want to delete all rows that have col. status listed as shipped.

/Create Procedure [DeleteOld] AS
/
/Delete Equipment
/FROM Yahoo
/WHERE Status <> 'shipped'

I have two rows of data, one row has a col. names status, and in that row of data says "shipped". The other row says "hold" in the place of "shipped".

The procedure is written, and is setting under that database ready to be run. I do not get any error's when I excute the procedure from SQL query, but it just does nothing when run!

I need help to make this procedure work properly

Thank You,

Ernie

P.S. I am new to this forum!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-31 : 10:13:30
"I want to delete all rows that have col. status listed as shipped."
delete table_name
where status = 'shipped'



KH

Go to Top of Page

mr_mist
Grunnio

1870 Posts

Posted - 2006-05-31 : 10:14:11
I want to delete all rows that have col. status listed as shipped

you do realise that your procedure says *not* equal to shipped?

-------
Moo. :)
Go to Top of Page

Ernie57
Starting Member

27 Posts

Posted - 2006-05-31 : 12:18:09
yes, and no! The statement has = not <>. With only two rows, something should get deleted, one or the other, and that's the problem, nothing happens!

Thank You,

Ernie
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-31 : 21:32:39

quote:
/Create Procedure [DeleteOld] AS
/
/Delete Equipment
/FROM Yahoo
/WHERE Status <> 'shipped'

What is the table name ? that you wanted to delete ? Equipment or Yahoo ?

Try the query i posted. Replace table_name with the actual table name. Like :
delete Equipment
where status = 'shipped'



KH

Go to Top of Page

Ernie57
Starting Member

27 Posts

Posted - 2006-06-03 : 08:24:58
quote:
Originally posted by khtan


quote:
/Create Procedure [DeleteOld] AS
/
/Delete Equipment
/FROM Yahoo
/WHERE Status <> 'shipped'

What is the table name ? that you wanted to delete ? Equipment or Yahoo ?

Try the query i posted. Replace table_name with the actual table name. Like :
delete Equipment
where status = 'shipped'



KH





Thank You,

Delete yahoo
where status = 'shipped'

Yahoo is the table name!

Ernie

P.S. Now works!
Go to Top of Page
   

- Advertisement -