Link to home
Start Free TrialLog in
Avatar of larisa1970
larisa1970

asked on

Importing Excel file into SQL Server 2008 (by BCP)

Is it possible to use BCP command to import XLS file into SQL server?
I mean not a CSV file but a regular spreadsheet?
Thank you!
Avatar of Brad Howe
Brad Howe
Flag of Canada image

Hi,

You can create a dataflow task in an SSIS package with an Excel file source to complete the import.

Cheers,
Hades666
Avatar of larisa1970
larisa1970

ASKER

But can  it be done using BCP command?
You could also just use the SQL Import and Export wizard.

1. Right-click on the database name, choose Tasks, and then Import Data

This will also create the SSIS package for you.

Cheers,
Hades666
Not that i know of.

Hades666
Here is the guidlines for BCP.

http://msdn.microsoft.com/en-us/library/ms188609.aspx

"To bulk import data from a Microsoft FoxPro or Visual FoxPro table (.dbf) file or a Microsoft Excel worksheet (.xls) file, you would need to convert the data into a CSV file that complies to the preceding restrictions"

Sorry,
Hades666
There is an existing process that dynamically loads and parses the file (using BCP). It used to be a csv file and there is a bunch of procedures written around it. Today the data provider changed it to excel file.
If I there's a way to bcp in an excel file - then I have to change only 1 line of code.
Otherwise I have to re-write the whole process
ASKER CERTIFIED SOLUTION
Avatar of Brad Howe
Brad Howe
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'll probably have to go with convertxls.
Thank you for your help