Forums Register Login

update query wont work in mysql, column name to blame?

+Pie Number of slices to send: Send
Hi All, I am trying to run the following query using mysql :

update alerttable set status=4 where status=0

The update does not happen. I am suspecting that it may be because I have the column named "status", is "status" a reserved word ? When I run the query, I do not get an error message, but the rows with status equal to zero stay at the value zero. The status column is defined as a tinyint.

I tried to pick a differant column of the table and rerun the query and it works fine , it just wont seem to work on this column. The column is not an index or key or anything like that.

Any tips? Thanks!
+Pie Number of slices to send: Send
Status is not a reserved word in MySql. Try re-typing the query by hand and/or removing the "where status = 0" clause and see if that works.
+Pie Number of slices to send: Send
Thanks very much. I wonder if something wierd is going on with my sqlYog app which is what I am using to run the query. I tried to run it again on a differant database I had , and this time it worked. Not sure what is up, but I do appreciate your input ! Thanks for letting me know that status is not a reserved mysql word.
+Pie Number of slices to send: Send
Here's a link to all reserved words (thanks google!):

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
+Pie Number of slices to send: Send
Are you using prepared statements to run the query. I onced suffered a few hours with that in MySQL, and it happens that MySQL does not support prepared statements, therefor it simply ignores the query and does nothing.

It really pissed me off, because it worked fine in PostgreSQL.

Maybe that helps!
+Pie Number of slices to send: Send
 

Originally posted by Edwin Dalorzo:
...and it happens that MySQL does not support prepared statements...

Good thing I didn't know that. Because I have an application that uses PreparedStatements to read and update a MySQL database. It works fine and has been working fine for several years now.
+Pie Number of slices to send: Send
As far as I know, the prepared statement feature is present since version 4.1. Then it could be a good idea to check anyway.
[ July 25, 2006: Message edited by: Edwin Dalorzo ]
+Pie Number of slices to send: Send
 

Originally posted by Edwin Dalorzo:
...and it happens that MySQL does not support prepared statements



Ummmm... what driver are you using?
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1636 times.
Similar Threads
executeUpdate method is returning zero.
Update Table Nested Query (Using Function)
proble with preparedStatement
Using non-qualified column reference Error
Using non-qualified column reference Error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:23:48.