Saturday 25 January 2020

Update statement in T-SQL

Hi All,

Hope you all are doing good.

In this article, we will know about how to update data in a table.

Syntax:
UPDATE table_name
SET col-1 = val1, 
       col-2 = val2, 
       ... 
       col-n = val-n
        [WHERE condition]

Update value of a single column in all rows example:
UPDATE CUSTOMERS
SET ADDRESS = 'Bangalore'
WHERE ID = 6;

Update values of 2 or more columns example:
UPDATE CUSTOMERS
SET ADDRESS = 'Bangalore', SALARY = 20000.00;
WHERE ADDRESS = 'Mangalore'

Note: Be careful while using update statement. If you miss WHERE clause, all records will be updated.

Thanks for reading my article.

No comments:

Post a Comment

Intoduction to Flutter

Hi All, I hope every one is doing good In this article, we will know about the introduction of Flutter.