Is there a limit to the length of a number in an integer field?

myron_mccarthy
Kilo Explorer

It appears when I enter a number larger then 10 digits into an integer field, the field is populated with 2147483647 (which interestingly enough is only one of 4 double mersenne primes). Is this a limitation of that field type?

1 ACCEPTED SOLUTION

domaners
Kilo Guru

This appears to be a limitation of the MySQL database that Service Now is hosted on, I don't think there's much you can do about this. The following wiki article demonstrates that Integer fields in Service Now are saved Integer data type (no surprises there!).



http://wiki.servicenow.com/index.php?title=Introduction_to_Fields#Database_Field_Types



Looking at the online MySQL documentation, it is shown that the max value that can be stored in a signed Integer variable is 2147483647, as you have witnessed.



MySQL :: MySQL 5.1 Reference Manual :: 11.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, ...



It may be worth raising a ticket on Hi to see if one of their DBA's can change the data type on this field to unsigned Integer (which would mean no negative values), or BIGINT. This may require a new field to be set up though, as I'm not sure if MySQL will be able to convert datatypes in this way.


View solution in original post

9 REPLIES 9

RKumar3
Tera Guru

By Default Max Length for a field is 40. Change it to something like 100 in field's dictionary and you will be able to enter more than 10 digits.



Right Click the field ->Personalize Dictionary -> update "Max Length" field to 100


Subhajit1
Giga Guru

Hi Myron,


I suppose you might be doing a configuration for Phone Numbers:-


You might take a look at this link:-


http://wiki.servicenow.com/index.php?title=Using_Phone_Number_Fields



Thanks,


Subhajit


No, but thank you. This is interesting.


domaners
Kilo Guru

This appears to be a limitation of the MySQL database that Service Now is hosted on, I don't think there's much you can do about this. The following wiki article demonstrates that Integer fields in Service Now are saved Integer data type (no surprises there!).



http://wiki.servicenow.com/index.php?title=Introduction_to_Fields#Database_Field_Types



Looking at the online MySQL documentation, it is shown that the max value that can be stored in a signed Integer variable is 2147483647, as you have witnessed.



MySQL :: MySQL 5.1 Reference Manual :: 11.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, ...



It may be worth raising a ticket on Hi to see if one of their DBA's can change the data type on this field to unsigned Integer (which would mean no negative values), or BIGINT. This may require a new field to be set up though, as I'm not sure if MySQL will be able to convert datatypes in this way.