Convert nvarchar to int in SQL

Hi Experts,
I would like to convert "005000000000" currently in varchar(12) into just show "5000000000", tried to convert into int but has the following error

"Msg 248, Level 16, State 1, Line 1
The conversion of the varchar value '005000000000' overflowed an int column. Maximum integer value exceeded."

Reason not using substring function is the value will always change so substring wont work =\

Please kindly assist
salesprodAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AdrianSRUConnect With a Mentor Commented:
The largest integer column type in MySQL is bigint.  If you will never have negative numbers then you may want to use unsigned bigint.


--Adrian
0
 
brad2575Commented:
The number is too long for an int, you can try a long data type (instead of int).  

note:  I have not confirmed that "long" is a data type in MYSQL but it would be something like that, if not "long" then "number".
0
 
Ray PaseurCommented:
You should consider using a DECIMAL field, however a BIGINT field might do the trick.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.