开发者

MySQL: update without changing data, possible?

开发者 https://www.devze.com 2023-04-04 20:48 出处:网络
Is it possible in MySQL to update a row, without changing any data? I just need a trigger to do its work, but the data should not be changed.

Is it possible in MySQL to update a row, without changing any data?

I just need a trigger to do its work, but the data should not be changed.

Of course I could do an update and then another update, but the trigger is quite slow (deletes and inserts 500 rows everytime) and I have to update thousands of rows, so I'd rather not do it twice.

I could also just update a dummy field with开发者_JAVA技巧 NOW(), but I'm just curious if it's possible without 'tricks'.


How about:

UPDATE table SET id=id WHERE ...


You should just be able to run an UPDATE command with the same data that already exists in the row. No data will change, but the trigger will still fire.

0

精彩评论

暂无评论...
验证码 换一张
取 消