Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
divan
Posting Yak Master
153 Posts |
Posted - 2012-08-16 : 09:16:31
|
| I am trying to create a table in sql using the import and export data function in sql.. my input file is a xls file and the first column is a a 3 character code the codes that start with a 0 (eg 010, 015, 020) get imported correctly but then the codes that start with anything but 0 are imported as a NULL.column in xlsOPCO_CODE005020025100105110115code in sql005020025NULLNULLNULLNULLNULLany idea |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-08-16 : 09:49:06
|
| This usually happens if you have a column that is numeric in the initial few rows and have non-numeric values in the later rows. Import Wizard samples the first few rows and decides that it is a numeric data type and goes on with the import, but then when it runs into non-numeric data, it throws up its hands and the table ends up getting nulls.In your cases, that does not seem to be the case - in fact it seems to be the opposite.Do you have any non-numeric data in that column? If so, in the import/export wizard, in one of the screens in the wizard, there is an Edit Mappings button - click that and make sure the column is designated as character type.What is the data type of the column in the destination table? If it is numeric, then you cannot have non-numeric data in the excel file.Not very precise answers, are they? I am just guessing here :) |
 |
|
|
divan
Posting Yak Master
153 Posts |
Posted - 2012-08-16 : 09:58:43
|
| SUNITABECK If I was a gambling man I would hire you to be my advisor.. Your guessing here was very accurate.... |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-08-16 : 11:28:23
|
| Ha! It just so happens that I am looking for a position as an adviser to gamblers. :)Just kidding! Glad you got it figured out!! |
 |
|
|
|
|
|