Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAST or CONVERT Big Int

Status
Not open for further replies.

GROKING

Programmer
Mar 8, 2005
26
US

I have a column with datatype BIGINT which is a 64 bit unsigned, numeric. The actual length of the data is only 13 integers.

I am needing to convert BIGINT to INT(13) or to a string (CHAR) so that I can load it into another datebase.

The BIGINT comes through an ODBC as exponential, which is worthless to me.

SO I want to create a view of the table and which converts or casts the bigint to another datatype like NUM.

I used this query and it seems to work:
select CAST(order_number as CHAR), date_created
from transaction_credits
where date_created > '20070103'

But I would prefer to convert the BigInt to an Integer(13).

Has anyone a solution for this, or a way to configure the mysql ODBC to automatically cast or convert the big int datatype??

Thanks for the help!!

 
the number that you see after an integer datatype, e.g. INTEGER(13), does not have anything to do with how many digits the integer column can hold

INTEGER(13) and INTEGER(4) and INTEGER(937) all hold exactly the same range of numbers

CAST your BIGINT to CHAR

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top