I have the following select statement.
I would like to update the values of ContactAssociate from ‘Bob’ to ‘Jane’. Is it possible to do this?
SELECT TOP (1500) ContactID, ContactNotes,
ContactAssociate, ContactAppointment
FROM
tb_Contact
WHERE
(ContactAssociate = 'Bob') AND
(ContactAppointment = 0)
Use:
The query you supplied checked for
contactappointmentbeing zero – if you wanted to include that check, the query would be:The
UPDATEstatement doesn’t support theTOPkeyword, so your update statement would be:…but that will give random contacts – you should specify an
ORDER BYclause in the subquery to get consistent results.Reference: