Thursday, October 14, 2010

String Handling Functions - Part 1 By Andy Warren

In this video, within 6 min. 29 secs Andy not only shows the usage of Lower, upper, left, right, ltrim and ltrim functions but also displays a few what if scenarios which we may otherwise not think about if we just go by the book.

Here are my learnings:
  • upper and lower functions does not return an error when used with null data.
  • The second argument for left and right functions should be a positive value and cannot be a negative value.
  • If a negative value is used the select statement errors out.
  • If a zero is used as the second argument it does not return an error but it just returns a blank row.
  • There is no trim functions. If you need a trim function in sql then combine the ltrim and rtrim functions to get the desired result. Eg: rtrim(ltrim(@test))

No comments:

Two ways to reset the identity of a table in sql server.

I know of the following two ways to reset the identity of a table in sql server. You often tend to use dummy data during the course of y...