UPDATE statement 
Author Message
 UPDATE statement

Quote:

>    String updateString =("UPDATE StockTable "
>         + "SET Description = Description "
>         + "SET Price = Price "
>         + "SET InStock = InStock "
>         + "WHERE ID + ID");

Your SET clause is wrong. In SQL UPDATE, there is a single SET keyword followed by
assignments separated by commas:

   String updateString =("UPDATE StockTable "
        + "SET Description = Description,"
        + "Price = Price,"
        + "InStock = InStock "
        + "WHERE ID = ID");

Note that I also corrected your WHERE. WHERE must be followed by a predicate expression
not an arithmetic expression.

--
Lee Fe{*filter*}an, FFE Software, Inc. ( http://www.***.com/ )



Tue, 23 Apr 2002 03:00:00 GMT
 UPDATE statement

Hi all,
           I am having a bit of a problem with an UPDATE statement to an MS
Access database. All of my other statements work well, such as DELETE,
SELECT, etc. Could someone have a look at my code below, and show me where I
have made a mistake? As it stands, I get a syntax error with the UPDATE
statement. I am sure it is something simple, so any pointers will be
appreciated.  I have included an example below:

   Statement stmt = conn.createStatement();

   String updateString =("UPDATE StockTable "
        + "SET Description = Description "
        + "SET Price = Price "
        + "SET InStock = InStock "
        + "WHERE ID + ID");

   stmt.executeUpdate(updateString);
   conn.commit();
   stmt.close();



Wed, 24 Apr 2002 03:00:00 GMT
 UPDATE statement
Hi Lee,
            thanks for that. I managed to figure it out myself anyway, after
much trial and error. The WHERE clause was just a typo, it was the SET
clause that I had the error with.

Quote:

> >    String updateString =("UPDATE StockTable "
> >         + "SET Description = Description "
> >         + "SET Price = Price "
> >         + "SET InStock = InStock "
> >         + "WHERE ID + ID");

> Your SET clause is wrong. In SQL UPDATE, there is a single SET keyword
followed by
> assignments separated by commas:

>    String updateString =("UPDATE StockTable "
>         + "SET Description = Description,"
>         + "Price = Price,"
>         + "InStock = InStock "
>         + "WHERE ID = ID");

> Note that I also corrected your WHERE. WHERE must be followed by a

predicate expression

- Show quoted text -

Quote:
> not an arithmetic expression.

> --
> Lee Fe{*filter*}an, FFE Software, Inc. ( http://www.***.com/ )



Wed, 24 Apr 2002 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Case Statement in Update Statement

2. Help me convert a SELECT statement to an UPDATE statement

3. Update statement creates Error, when statement is fine

4. Update statement with correlated subquery inside case statement fails

5. Recorset.Update vs SQL Update statement

6. Update locks in multi-table update statements

7. Updating records with UPDATE Statement error

8. UPDATE statement may update more records than expected

9. Update Memo-Column with SQL UPDATE Statement

10. Problem updating same row twice in update statement

11. simple update statement

12. INSERT INTO and UPDATE statements


 
Powered by phpBB® Forum Software