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 2000 Forums
 Transact-SQL (2000)
 Using BULK INSERT to Load a Excel file

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2005-01-01 : 03:54:48
hi,

how to import excel sheet data into sql server table.
any idea is appreciated.

bye

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-01-01 : 08:22:08
BULK INSERT only works on text format files. You'd have to save your Excel data to a comma- or tab-delimited file in order to use BULK INSERT or bcp on it. DTS can import Excel data directly.
Go to Top of Page

imughal
Posting Yak Master

192 Posts

Posted - 2005-01-03 : 10:53:14
thanks
i m using below code and getting error

BULK INSERT irfankse
FROM "c:\test\irfankse.txt"

Server: Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 1, column 1 (ksedate).

kindly fix it
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-01-03 : 13:12:58
I can't fix it without knowing the structure of the table you're importing into or the format and content of the text file you're importing. From the error message presented, it appears that the ksedate column is a datetime and that the data in the text file is not formatted as a valid date.

Qutie often, Excel does not reliably export data into other formats. You must look at the file in a text editor (Notepad) and see exactly what is there. Quotation marks, commas, tabs, etc. can interfere with the BULK INSERT process. There are ways to make the format work, but you have to provide more information.
Go to Top of Page
   

- Advertisement -