May 2, 2014 at 2:02 am
Hi,
I am using this query to show my column as money and I need to remove the decimal values on top of this query
Query:
'$ '+ Replace(CONVERT(varchar,CAST(Finance_Report As money),1),'.00','') as FinanceReports,
May 2, 2014 at 2:17 am
vigneshkumart50 (5/2/2014)
Hi,I am using this query to show my column as money and I need to remove the decimal values on top of this query
Query:
'$ '+ Replace(CONVERT(varchar,CAST(Finance_Report As money),1),'.00','') as FinanceReports,
What data type is column Finance_Report?
Please provide a script to generate a few sample rows with representative values, along with the expected output from those values.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 2, 2014 at 2:58 am
the datatype is decimal(10,4)
Current Value:
12,589.25
Expected Output:
12,589
May 2, 2014 at 3:02 am
I maynot be clear the scenarios . But let ask you why don't you convert into INT instead of Money . Any way you don't need decimal places.
May 2, 2014 at 3:07 am
Normally this is done in the presentation layer, but if you must then
'$' + REVERSE(SUBSTRING(REVERSE(CONVERT(varchar,CAST(Finance_Report As money),1)),4,255)) AS [FinanceReports]
Far away is close at hand in the images of elsewhere.
Anon.
May 2, 2014 at 3:08 am
vigneshkumart50 (5/2/2014)
the datatype is decimal(10,4)Current Value:
12,589.25
Expected Output:
12,589
Always truncating, never rounding? What about 12,589.99?
Your expected output omits a '$' character present in your first post, do you want this or not?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply