BIGINT datatype prior to ASE 15.0.2?

Not quite but close! 🙂 Thomas Kennedy asked on the mailing list what the equivalent of the BIGINT datatype is:


Can anyone recommend a equivalent data type to the BIGINT (not supported in 12.5) for 12.5?

Thanks in advance,

Tom Kennedy

We can emulate the bigint on prior ASE releases by using the numeric(19,0) data type:

1> create rule rule_BIGINT as
2> @x 
3>    between
4>      (9233372036854775808 * -1) and
5>      9233372036854775807
6> go

1> sp_addtype pseudo_BIGINT, "numeric(19,0)", "not null"
2> go

1> sp_bindrule rule_BIGINT, pseudo_BIGINT
2> go

Notice that we create a user defined data type called pseudo_BIGINT based on a non-null numeric(19,0) data type. If we didn’t limit the values to between -9233372036854775808 and 9233372036854775807, the fields would over/under flow when we upgraded to v15.0.2 (or higher) and attempted to change the data type to a real BIGINT. Why must you multiply 9233372036854775808 by -1? It’s a parsing bug within ASE.

Aditya over at Sybase listed the method to convert the pseudo_BIGINT to a real BIGINT:


A word of caution: rules are automatically but temporarily disabled when a bulk copy (bcp) or select into is performed on the table. You will need to modify the data prior to importing the data or after importing.

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *