converting varchar to money part 2

Hello experts:

I orginally asked this question here:  http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21708078.html


Since then I'm having problems with this DTS.  It now fails on the line I use to convert my weird "0*100*0" rows to true money fields.  
This is the error I get now:  Cannot convert a char value to money. The char value has incorrect syntax.

This worked back when I first tried it and now I'm coming back to this DTS package and its failing on these conversions.  Any ideas?  I scanned the entire table looking for something out of the ordinary and I found nothing.  The fields in my temp table are in varchar format.  Final table is set to money.  

help!

jay-areAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
What is the contents of the file?
Is the DTS trying to convert to money into the temp table directly?
are there any NULL values?
illCommented:
-- please, check rows returned from this
select * from SERVICEINVOICE
where isnumeric(cast(replace(replace(TXBL,'0*',''),'*0','') as money) / 100) <>1
jay-areAuthor Commented:
angelIII:  You can see some examples of what's in the file in the link above.  The DTS is trying to convert to money on the insert/update statements.  Convert from the temp table to the final table.  I checked through 16k rows for anything out of the ordinary and couldn't find it.  I found one amount that was "23000*0*23500".  I didn't know if that would screw with the replace so I deleted that specific row and the insert still failed...

ill:  I will run your select shortly.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

illCommented:
--when i'm looking at the statement now, i can see, that it solves nothing, as it already contains convert. This one may help you to detect "bad" lines
select * from SERVICEINVOICE
where isnumeric(replace(replace(TXBL,'0*',''),'*0','') ) <>1
jay-areAuthor Commented:
Ok ill, I ran your select and it comes up with a line where the txbl field is "1450*0*45522"

I ran this across the 2 other columns that are using this same convert and I came up with more.  There are 3 lines in total that have more than one amount in these "0*0*0" columns...How can I get around this?
jay-areAuthor Commented:
How difficult would it be to add the amounts together in these 3 lines?
50*0*100 to 1.50
etc

??
It seems to be a data error.  The user entered the amounts on the wrong line so I have these 3 lines with bad amounts...
jay-areAuthor Commented:
Any ideas?
illCommented:
-- one more replace is needed as there is no "*0" in the field after replacing "0*"
update SERVICEINVOICE_final set TXBL = convert(money,cast(replace(replace(replace(serviceinvoice.TXBL,'0*',''),'*0',''),'*', '') as money) / 100,1) from serviceinvoice where serviceinvoice.ronum = serviceinvoice_final.ronum

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
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.