user1254579
user1254579

Reputation: 4009

Excel to SQL table field value appending with 0

I loaded an Excel file into an SQL table. The Excel file, one field consists of VARCHAR data (of data type general). When loaded into an SQL table, some of these values are prefixed with zero.

Example: in the Excel file it is 1081999 the same value become 01081999 in the SQL table.

What might be the reason for this ?

Upvotes: 0

Views: 41

Answers (1)

Milney
Milney

Reputation: 6427

Excel will hide leading 0's as it identifies the fields content as a number and displays it as such. I would assume that the excel worksheet does indeed contain these leading 0's and they are simply not shown by Excel. If you change the type of the column from General to Text do they show up??

As a side note, if these are indeed numbers you should be storing them in a numeric datatype in the database...

Upvotes: 2

Related Questions