I faced an interesting problem as… I have MSSQL (2005) table A which contains money type column; the thing is I want to insert value to this column with T-SQL procedure call from Java code but I am not pretty sure which Java type should I use to prepare statement for this column to insert value?
I couldn’t find any example so maybe you can share some helpful snippets.
Any useful comment is appreciated
OK…
things I could figure out is NOT TO USE money type directly just because the jdbc4 connector PrepareSatement does not contain setMoney etc so I want to share some walk around… Of course, it is not the final code way but still…
So
A) Money class from here to get string as $00.00 with
displayAsDollars method
B) create mssql procedure with code like a
C) So the proc call is quite simple as
//…
As I was saying it is not the final code decision but a temp conception which may be helpful as well if you really need to use money type in your old mssql database. At least it was a temp answer in my case 🙂
I hope it will be helpful for someone 🙂
Good luck