Add decimal point in output of Text Field in SQL View

I have completed a table that list all of my ICD10 codes utilized in my office, they are specifically stored in my table as a text field without a decimal point so that it can be used for exportation into my billing program.  However I have an oversight agency that wants the data of the ICD10 Diagnosis codes WITH the decimal point.  I currently have a view that compiles all of my data together so that it can be exported with the proper order and number of fields into a pipe delimited file.  Subsequently this is uploaded into their server.

My diagnosis fields need to be converted in the view to include a decimal point after the third character if the data has more than three characters.

I am looking to make the following work:
F89 to F89
F1120 to F11.20
F29 to F29
F39820 to F39.820
F2245 to F22.45
and so on.

There are 65,000 codes stored within the table and any might have to be reported out that do not have the decimal placement.  Billing programs do not allow the decimal and yet I need to have it to be in compliance with oversight agencies.

Therefore I am hoping that there might be a SQL Convert or Cast statement that can be used to solve the issue.  Does anyone have suggestions to make this work without restructuring all the data fields within the tables.
JasBradAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mankowitzCommented:
select left(icd,3) + "." + substring(icd, 3,99)
0
pcelbaCommented:
The above solution requires a small fix because it repeats the 3rd character in the result.

Also to avoid unwanted point for 3 chars long codes I would rather use more complex expression (replace the column name please):

SELECT CASE WHEN LEN(icd10) > 3 THEN left(icd10, 3) + '.' + substring(icd10, 4, LEN(icd10)-3) ELSE icd10 END as icd10dotted

SQL Server 2012 and newer could also use IIF() function instead of the CASE.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JasBradAuthor Commented:
Worked great, good thing I only have to type it in once and have it work.  Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.