Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bulkcopy: mssql: type 6e not implemented #460

Open
subhransus2 opened this issue Mar 28, 2019 · 3 comments
Open

bulkcopy: mssql: type 6e not implemented #460

subhransus2 opened this issue Mar 28, 2019 · 3 comments

Comments

@subhransus2
Copy link

When I am trying to perform bulk insert in my project, I found an error like below.
error="bulkcopy: mssql: type 6e not implemented"

After debugging the issue I found that, there is no code in the package for managing the data type of money.
Please check the bulkcopy.go file line 456. The case for handling money type is commented there.
// case typeMoney, typeMoney4, typeMoneyN:

As my database table contains some fields of money type, so I got above error.
Can you please suggest how to manage data if the database contains field of type money?

@kardianos
Copy link
Collaborator

There is an open PR to fix this. It is waiting until I resolve how to make decimals work.

Out of curiosity, what Go type are you using to represent your Money type?

@subhransus2
Copy link
Author

For now I am using float32 for Money type, also tried float64 previously.

@Lercher
Copy link

Lercher commented Dec 19, 2023

For easier reference: https://github.com/denisenkom/go-mssqldb/blob/master/bulkcopy.go#L504

My five cents:

On "Out of curiosity, what Go type are you using to represent your Money type?", I guess, sth similar to what is supported for decimal: ints, floats and string. The implementation for decimals converts parameters to the var dec decimal.Decimal but it doesn't not support decimal.Decimal itself b/c that's an internal type. IMHO it should be considered to make this type public to provide an option for pulling out the conversion into the client.

As far as I remember the reason for using money was to enable precise 8byte calculations with four fixed decimal digits and a lot of valid digits before the decimal point for very large amounts of money. Float64 is quite nasty in comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants