MSSQL Invalid precision value

Hi,

I face an EAureliusOdbcException with message 'Error -1: [Microsoft][ODBC Driver 11 for SQL Server]Invalid precision value' on a field that is declared as Nullable<Double> on the model and as float at SQL Server (version 2014).

I also tried as Decimal(5,2) but the same happens.

I face the error on every number I insert, even 0.

What I miss here?

Hi,

I cannot reproduce the problem here. Can you maybe try with a different MSSQL driver and/or different SQL Server version to see if it makes a difference?

How to use different SQL driver? Do you mean use FireDac instead of Native driver?

No, I mean SQL Server driver itself: https://docs.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server

Please tell me, which driver do you have?



Moreover can I use another driver SQL Server let's say SQL Server Native Client ?

Thanks again

I tested with both "ODBC Driver 13 for SQL Server" and "ODBC Driver 17 for SQL Server", both work. Connecting to both "SQL Server 2017" and "SQL Server 2008". 

SQL Server Native Client should also work.

How can I use SQL Server Native client, is there a specific param to use on TAureliusConnection?

You can change global MSSQLOdbcDrivers variable (declared in unit Aurelius.Drivers.MSSQL) and put the driver names you accept to use:




  MSSQLOdbcDrivers := ['SQL Server Native Client 11.0'];




It's very strange, its not a driver issue.
When I insert the values saved ok at the database. But If I load and edit them then I get a precision error value.

Found it the problem was not on a numeric field but at a field nvarchar(max).

When I post and the field was empty the precision error came up, change the field to a varchar(500) and works fine.

Perhaps is a bug on how aurelius manages the specific type.
 

Can you please provide the exact steps to reproduce the issue?

Use DataModeler to create a table (MSSQL) that has a field nvarchar(max). I use TAureliusDataset to bind the table to a grid. Create a new record and leave that field empty. If it is saved correctly, make a change on another field and post the changes.

Still cannot reproduce. Can you please be more specific? Or send a sample project?