UPDATE Stored Procedure

A

ashg657

Heres a quick question,
Below is my first stored procedure (I am a beginner at this):

CREATE PROCEDURE "pricesupdate"
UPDATE PRODUCTS
SET PRODUCTS.CURRENTSELLINGPRICE = PRODUCTS.NEWSELLINGPRICE
FROM PRODUCTS
WHERE PRODUCTS.DATEOFPRICECHANGE = DATE AND PRODUCTS.NEWSELLINGPRICE > "0";

I keep getting the error "Incorrect syntax near the keyword UPDATE". Can
anyone shed some light on to what I am doing wrong here?
Thanks in advance.
 
D

Duane Hookom

This is more appropriate to ask in a SQL Server news group, however, I think
you need to:
- remove the quotes from around "pricesupdate"
- add "AS"
- remove "FROM PRODUCTS"
- remove the quotes from around 0
- remove the ";"
I don't know if you have a field named "DATE" or if you expect this to be
the GetDate() function. GetDate() returns the time with the date.

CREATE PROCEDURE "pricesupdate"
AS
UPDATE PRODUCTS
SET PRODUCTS.CURRENTSELLINGPRICE = PRODUCTS.NEWSELLINGPRICE
WHERE PRODUCTS.DATEOFPRICECHANGE = DATE AND PRODUCTS.NEWSELLINGPRICE > 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top