July 17, 2012 at 2:31 am
I am trying to import data from excel to SQL.
My excel has 10 columns and 2000 rows. COl A has first 1000 rows as float values and next 1000 as string values.
I am using Excel Source to read .xlsx file.
I am able to load float values into SQL table but the string values are getting imported as NULL.
I appreciate the help in advance!!!
July 17, 2012 at 3:42 am
Check your destination table column datatype.I think you are inserting the text values into destination column which is having the datatype as Numeric. 😉
If the destination column is Numeric you have to change it as Varchar or nvarchar based on your requirement.
July 17, 2012 at 3:57 am
no it is nvarchar..
July 17, 2012 at 4:16 am
CREATE TABLE Test(
ColA [varchar](500) NULL,
ColB [nvarchar](500) NULL,
.
.
ColK [nvarchar](500) NULL,
)
I am getting NULL records inserted in COl A instead of string values...
July 17, 2012 at 4:31 am
balaji_kethe (7/17/2012)
CREATE TABLE Test(ColA [varchar](500) NULL,
ColB [nvarchar](500) NULL,
.
.
ColK [nvarchar](500) NULL,
)
I am getting NULL records inserted in COl A instead of string values...
I'm going to make the assumption that columns ColC to ColJ are also nvarchar.
For future reference, you can help us and yourself a good deal faster by posting enough information to allow others to run the same tests. Have a look at http://www.sqlservercentral.com/articles/Best+Practices/61537/ to help you post a more structured question in future.
Now, back to your data. Could you possibly locate a row of data from your Excel file that you believe should import but does not? Ideally this should be saved in a new Excel file and posted here but I'm willing to have some type of copy/paste if you can't manage that.
Then, can we see the code that you use to import the spreadsheet into the file - or a version of that code if it contains any confidential information that we shouldn't be seeing.
It may seem like a lot of work for such a small issue, but all of this work allows others to reproduce the problem, and in preparing this you may well find that you solve the issue yourself. I've prepared data several times in the past that I've never had to post, because preparing a simplified example for posting has actually helped me solve the issue myself.
July 17, 2012 at 1:42 pm
Post your Excel file to this thread as an attachment.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply