https://bugs.documentfoundation.org/show_bug.cgi?id=162219

            Bug ID: 162219
           Summary: Unable to insert decimal values in Base into a decimal
                    column in SQL Server
           Product: LibreOffice
           Version: 24.2.5.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Base
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: j...@jtenos.com

Description:
When inserting or updating a decimal value into a table in SQL Server, I get
the following error:

SQL Status: HY104

[Microsoft][ODBC Driver 18 for SQL Server]Invalid precision or scale value at
C:/cygwin64/home/buildslave/source/libo-core/connectivity/source/drivers/odbc/OTools.cxx:352

Error updating the current record at
C:/cygwin64/home/buildslave/source/libo-core/connectivity/source/commontools/dbtools.cxx:744

Steps to Reproduce:
1.
-- SQL Server 2022
CREATE DATABASE [base_sandbox];
GO
USE [base_sandbox];
CREATE TABLE [dbo].[Foo] (
     [ID] INT NOT NULL IDENTITY PRIMARY KEY
    ,[SomeValue] [decimal](19, 4)
);
GO

2.
Open ODBC Data Source Administrator (64-bit)

3.
Create new User DSN

4.
ODBC Driver 18 for SQL Server

5.
Name: base_sandbox

6.
Server: (local)

7.
Default database: base_sandbox

8.
Open Base

9.
Connect to an existing database: ODBC

10.
Name: base_sandbox

11.
Save the odb file and open for editing

12.
Navigate to tables: dbo.Foo

13.
Open the table for editing data

14.
Attempt to insert or update the value to any number:
1.0000
0.0000
1.2000
1.2345
1.2340

Values 1.0000, 0.0000, 1.2000 fail with the listed error. Values 1.2345 and
1.2340 succeed.


Actual Results:
SQL Status: HY104

[Microsoft][ODBC Driver 18 for SQL Server]Invalid precision or scale value at
C:/cygwin64/home/buildslave/source/libo-core/connectivity/source/drivers/odbc/OTools.cxx:352

Error updating the current record at
C:/cygwin64/home/buildslave/source/libo-core/connectivity/source/commontools/dbtools.cxx:744

Expected Results:
Should have inserted/updated the values.


Reproducible: Sometimes


User Profile Reset: Yes

Additional Info:
This happens with both v17 and v18 of the ODBC driver. I'm on Windows 11 Home. 

Running Base 24.2.5.2.

Tried different decimal sizes and precisions, same problem.

In .NET, I'm able to successfully insert:

using System.Data.Odbc;
using OdbcConnection conn = new("DSN=base_sandbox");
conn.Open();
using OdbcCommand comm = conn.CreateCommand();
comm.CommandText = "INSERT INTO [dbo].[Foo] ([SomeValue]) VALUES (?);";
comm.Parameters.Add(new OdbcParameter("?`", OdbcType.Decimal) {
        Size = 19, Precision = 4, Value = 123.5m 
});
comm.ExecuteNonQuery();

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to