[odb-users] MSSQL NUMERIC

Sten Kultakangas ratkaisut at gmail.com
Wed May 18 03:09:06 EDT 2022


Hi
If you just access the table and do not use schema creation/migration code,
then you can just define NUMERIC(18,0) as "long long" in your C++ code. For
example,

#pragma db object schema("Foo.dbo")
struct Bar {
  #pragma db id auto
  long long ID = 0;
}

The actual type of the ID field can safely be NUMERIC(18,0). In most cases
there is no problem in conversion between BIGINT and NUMERIC(18,0).

Alternatively, you can implement your own
odb::mssql::value_traits<FixedType<18,0>, id_decimal> specialization.

Best regards,
Sten Kultakangas



On Tue, May 17, 2022 at 6:43 PM luca paganotti <luca.paganotti at gmail.com>
wrote:

> Hi all,
>
> I'm trying to map a NUMERIC(18,0) field in a MSSQL table to some datatype,
> reading the docs I found that there's no direct mapping, do I have to
> build my own mapping? Could someone give some hint on how to map this data
> type?
>
> Thanks.
>
> ----------------------------------------------------------------
> -- Dott. Ing. Luca Paganotti
> -- Via Baroffio 4
> -- 21040 Vedano Olona (VA)
> -- 393 1346898
> ----------------------------------------------------------------
> -- softech s.r.l. email:
> -- luca.paganotti at softechweb.it
> -- luca.paganotti at gmail.com
> -- https://github.com/lucapaganotti
> -- sourceforge email:
> -- lucapaganotti at users.sourceforge.net
> -- skype name: luca.paganotti
> [image: http://it.linkedin.com/in/lucapaganotti]
> <http://it.linkedin.com/in/lucapaganotti>
> -- ---------------------------------------------------------------
> -- Mistakes are portals of discovery - JAAJ
> --- --------------------------------------------------------------
>


More information about the odb-users mailing list