In the previous post you have learnt how to delete rows from table in SQL Server database. The rows inserted into a table are dynamic in nature. The records are changed over the course of time and the table must be updated to reflect the changes. For example, in a company, the salary of employees will change over the years and therefore salary must be updated. In this tutorial you will learn how to update records in a table in SQL Server.
How to Update Records in Table
Now you discuss about how to update table in SQL server. Update command is used to update a table records. The UPDATE command must include SET clause which is used to set value of different columns. Each column must be initialized with valid value which is being updated and they must be separated by comma in the SET clause. The WHERE clause in UPDATE command is used to update certain rows conditionally
Update Table using a lookup table
You should use sub query with update command to update a table based on the lookup values of another table. The sub query will return a result set which can be a unique ID or list of values.
In
the next post, you will learn SELECT Query clauses in SQL Server in different
ways.
No comments:
Post a Comment