Consider the following example
declare @amount decimal(12,2)
select parsename(@amount,2) as precision, parsename(@amount,1) as scale
The result is
Parsename is used to extract specified part of a name. In general, it is used to extract names from four part object names separated by a dot. Argument number 1 extracts the last part of a string, and the 2nd argument extracts the next last part.
This way we can effectively make use of parsename function to extract precision and scale values from the decimal numbers.
Did you like this post?
|subscribe via rss||subscribe via e-mail|
|print this post||follow me on twitter|