[unixODBC-support] Problem using SQL_C_SLONG

Nick Gorham nick at lurcher.org
Wed Jun 20 11:27:24 BST 2012

On 20/06/12 10:47, kapil bhadke wrote:
> Hi,
> I am working on migration of a system from 32 bit to 64 bit. The 
> problem I am facing is related to datatype long(which is 32bit on 32 
> bit system and 64bit on 64 bit system).
> I am using SQL_C_SLONG while fetching data from database which is 32 
> bits in size on 64 bit system and hence I am getting different value.
> I want a suitable datatype which will work according to the nature of 
> long datatype.
> Is there any way to achieve this??
> -- 
> Kapil Bhadke


SQL_C_SLONG despite the name, is defined as 32 bit both on 32 and 64 bit 
system. You need to use SQLINTEGER as the C defining type so you get a 
32 bit value in all cases.

If you do want to return a 64 bit value, use SQL_C_BIGINT

SQL_C_LONG = 4byte
SQL_C_BIGINT = 8byte


More information about the unixODBC-support mailing list