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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Import error from .CSV file?

Author  Topic 

mhagerman
Starting Member

3 Posts

Posted - 2009-11-11 : 12:20:31
Hi everyone,

So let me preface this post with a warning that I'm a huge database newbie. . . you've been warned!

I've been trying to re-establish an old database (not created by me) on a new GoDaddy hosted website. I had a .bak file to restore but GoDaddy informed me that I couldn't do a restore if the .bak file wasn't created on their own server. . . no big deal, I had the database exported into an excel spreadsheet instead since it's only one table. However, when I converted the excel file to a .csv and tried to upload it, I received this error:

Error importing data from db_file.csv.
Imported 0 rows.
Errors:
Line 1 has 29 values (23 expected).

I was required to create a table where I'd import the file, the problem is that I have no idea what I'm doing! I made a table with a matching number of columns in the spreadsheet and matching names, but to no avail. Maybe it has something to do with the character type I chose ("nvarchar" for all columns)? I really have no idea... I'm sure this is an obvious mistake but I just can't figure it out.

If it makes any difference, I'm trying to upload this file to a "SQL Server Database" with SQL 2005. I also have a MySQL database available to create, but I was told that this is where I should import the .csv file.

Thanks so much for your help!

Matt

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-11 : 12:23:19
what were you using for import? export import wizard or bulk insert or openrowset?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-11 : 12:25:12
First thought:
Your CSV-delimiter is also included somewhere in your column data.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

mhagerman
Starting Member

3 Posts

Posted - 2009-11-11 : 15:51:38
quote:
Originally posted by webfred

First thought:
Your CSV-delimiter is also included somewhere in your column data.



Yeah, you're right about that... there are quite a few commas in the data fields. Is there a way I can export it using a different character as a delimiter? The fact that it's called a "comma separated values" file makes me think not, but I don't really want to replace all of the commas in my data with something else.

quote:
what were you using for import? export import wizard or bulk insert or openrowset?


It's an import wizard.

Thanks guys!
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-11 : 16:02:00
When you step through the wizard there is the screen where you can choose the file's path and name and there you have to choose the type of file and you can choose the delimiter.

Your problem is to set the wanted delimiter in Excel - have a look in google. I think it depends on settings in your PC.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

mhagerman
Starting Member

3 Posts

Posted - 2009-11-11 : 19:38:19
quote:
Originally posted by webfred

When you step through the wizard there is the screen where you can choose the file's path and name and there you have to choose the type of file and you can choose the delimiter.

Your problem is to set the wanted delimiter in Excel - have a look in google. I think it depends on settings in your PC.



Thanks a bunch - finally got everything imported. It's a lot more complicated to change the delimiter for Excel than I assumed, though. . . I wonder why Microsoft didn't anticipate people not wanting to use a comma as a delimiter? Oh well. . . thanks a ton, webfred!
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-12 : 03:38:07
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -