Monday, October 22, 2012

Trim() & Parse() & Date Function


Trim() & Parse() & Date Function

The TRIM function in SQL is used to remove specified prefix or suffix from a string. The most common pattern being removed is white spaces. This function is called differently in different databases:

 The SQL Trim functions (LTRIM and RTRIM) are useful in cleansing data that contains leading and trailing blanks.

SELECT LTRIM(<value_1>)
  SELECT RTRIM(<value_1>)


What is the difference between PARSE() and TRY_PARSE() functions?

While attempting to PARSE any column, if you get one or more incorrect values, PARSE function will throw an error. However, if you use TRY_PARSE function, it will not throw error but will return the result as NULL.

No comments:

Post a Comment