I am trying to update multiple rows from node js to sql server database with no unique column.
now, I am trying to update 2 records at the same time,that is one property has two different owners.
UPDATE tbl_PropertyOwnerShip SET OwnerName = 'ross' , SinceFrom = '2012-12-12' where PropertyId = '59';
UPDATE tbl_PropertyOwnerShip SET OwnerName = 'mike' , SinceFrom = '2012-12-12' where PropertyId = '59';
Can anyone help me to sequencially update rows in sql server to get desired output?
You must have a unique ID or at least a different value in your rows. When you update the table with this WHERE clause: where PropertyId = '59'
, each time, it updates all the rows that have propertyId of 59.
Maybe you need to add a new table, then add all the rows in this table to the new table beside an unique ID there. or maybe, this answer helps you:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.