Monday, December 29, 2014



SUBSTRING ( expression ,start , length )

Is a characterbinarytextntext, or image expression.
Is an integer or bigint expression that specifies where the returned characters start. If start is less than 1, the returned expression will begin at the first character that is specified in expression. In this case, the number of characters that are returned is the largest value of either the sum of start + length- 1 or 0. If start is greater than the number of characters in the value expression, a zero-length expression is returned.
Is a positive integer or bigint expression that specifies how many characters of the expression will be returned. If length is negative, an error is generated and the statement is terminated. If the sum of start and length is greater than the number of characters in expression, the whole value expression beginning at start is returned
Sample: SELECT date, substring(recpt_desc, 1, 3), branch from DATABASE where date='2014-12-03' order by branch group by date, substring(recpt_desc, 1, 3), branch;