SQL SERVER

Update Query in SQL Server

In SQL Server by Baqir AliLeave a Comment

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 in SQL SERVER
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.

Update in SQL SERVER

Support us by sharing this post

About the Author

Baqir Ali

Facebook Twitter

Hi, I am Baqir Ali ---- Blogger, Programmer, and a Teacher. I am currently working as a Programmer for Softnat Technologies. I have tons of ideas and data to share with you all via blogging.

Leave a Comment