SQL read number> 15 digit in Excel

bruindav

New Member
Joined
Dec 4, 2009
Messages
3
How can I retrieve a number > 15 digits from a database into Excel using a SQL query. Excel will cut off numbers at 15 position. So a Creditcard nr (16 digits) will lose it lasts digit
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Welcome to the board..

In the database, store it as a TEXT instead of NUMBER.
 
Upvote 0
Thanks for the suggestion , but it is not possible to store it in de AS400 DB as text. I am not the owner of the database. I only have read permission. If you have any other suggestion you're welcome

Welcome to the board..

In the database, store it as a TEXT instead of NUMBER.
 
Upvote 0
Perhaps formatting the destination cells as TEXT, PRIOR TO retrieving from the database?
 
Upvote 0
If that doesn't work, I would try concatenating the telephone number field to a character to convert to text (do this in the SQL itself). You'd need to process it after import if you wanted to remove the character.

I'm not sure of the driver (ODBC or OLEDB) that you're using so the following may not work:

Code:
SELECT 'A' + [TelNoField] FROM Table

etc etc. If you can, I would go for a concatenation using the sigle quote ' character as it will hopefully be placed into the cells as a textual number requiring no further modification.
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,705
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top