How to update in SQL SERVER?
The Update query is used to update the existing data in the database. Suppose the data entered is incorrect and needs to be changed then we use an update query.
In the following example, ‘Suffix’ is NULL. Let’s fill them all with something.
UPDATE PERSON.Person SET Suffix='Mr. '
As we have not used the WHERE clause the above code will fill all rows with (Mr. ).
Updating Specific Row in SQL Server
In order to update a specific row we use the WHERE clause or to narrow our query.
UPDATE PERSON.PERSON SET FirstName='Dabeer',LastName='Haider' WHERE BusinessEntityID=1
The above code updates the first name and the last name of the BusinessEntityID of 1.
Support us by sharing this post