SQL is a standard language for storing, manipulating, and retrieving data in databases.
Returns the number of characters of the specified string expression, excluding trailing spaces.
To return the number of bytes used to represent an expression, use the DATALENGTH function.
The following example selects the number of characters and the data in FirstName column
SELECT LEN(FirstName) AS Length, FirstName
FROM Sales.vIndividualCustomer
WHERE CountryRegionName = 'Australia';
This function returns the number of bytes used to represent any expression.
To return the number of characters in a string expression, use the LEN function.
This example finds the length of the Name column in the Product table:
SELECT length = DATALENGTH(EnglishProductName), EnglishProductName FROM dbo.DimProduct ORDER BY EnglishProductName;
Source: DATALENGTH (Transact-SQL) - SQL Server | Microsoft Docs
The SQL UPDATE Statement
The UPDATE
statement is used to modify the existing records in a table.
UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
SQL SET Keyword
The SET command is used with UPDATE to specify which columns and values should be updated in a table.
The following SQL updates the first category (CategoryID = 1) with a new Name and a new Type:
Example
UPDATE Category
SET Name = 'Article', Type = 'Premium'
WHERE CategoryID = 1;