Consider the following example
declare @amount decimal(12,2)
set @amount=87234.50
select parsename(@amount,2) as precision, parsename(@amount,1) as scale
The result is
precision scale
--------- --------
87234 50
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 |




comments
0 Responses to "Parsename to Extract Precision and Scale values From Decimal Numbers"Post a Comment