Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6538263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:42:57+00:00 2026-05-25T10:42:57+00:00

I faced an interesting problem as… I have MSSQL (2005) table A which contains

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:42:58+00:00Added an answer on May 25, 2026 at 10:42 am

    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

      create procedure aschema.test @a varchar(10)
      AS
      BEGIN
      
      DECLARE @b money    
      SET @b=CAST @a AS MONEY
      
      --todo: insert next...
      
      END;
      
    • C) So the proc call is quite simple as

      Money m=new Money("12.99");
      
      callableStatement = (SQLServerCallableStatement) connection.prepareCall(
                              "{call "+
                              DATABASE_NAME+
                              "."+
                              SCHEMA_NAME+
                              ".test(?)}");
      callableStatement.setString(1,m.displayAsDollarsCorrectly());
      callableStatement.executeUpdate();
      

      //…

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am faced with an interesting problem and I am not even sure if
I have faced this problem quite often during the last couple of months, during
I've faced with a next problem: In our database we have objects with ids,
Today I faced an interesting thing as FF File API and separate files by
I've faced an interesting thing... All goes fine with null object When I add
I faced a very interesting fact, and hope you have an answer for that.
Here's an interesting problem. I have an ETL script written in c# that I
Faced with the challenge of a new application with which you had free reign
I faced with problem that geomap by google fails with JQuery together in Internet
I faced one issue while working on a C code with Microsoft Visual Studio-2005

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.