January 25, 2013 at 6:06 am
Hi all,
I have to bcp an excel to a table and when i give this command below, it is giving me the following error
Exec Master..xp_cmdshell 'bcp pmdb.dbo.abc in "C:\a.csv" -c -T '
Unexpected EOF encountered in the bcp data-file.
What is the EOF that i need to specify in the bcp command for an excel? if it is a text file, then i can do it, but, i am not sure what to do for a excel file. Any help would be hjugely appreciated.
Thanks,
Pramod
January 25, 2013 at 9:16 am
Please post the DDL for the "abc" table, and a few sample rows of data. Most likely it's just a matter of a missing row terminator or something similar i.e.(ROWTERMINATOR = '\r')
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
January 25, 2013 at 9:43 am
pramod.gururaj (1/25/2013)
Hi all,I have to bcp an excel to a table and when i give this command below, it is giving me the following error
Exec Master..xp_cmdshell 'bcp pmdb.dbo.abc in "C:\a.csv" -c -T '
Unexpected EOF encountered in the bcp data-file.
What is the EOF that i need to specify in the bcp command for an excel? if it is a text file, then i can do it, but, i am not sure what to do for a excel file. Any help would be hjugely appreciated.
Thanks,
Pramod
You say it is an excel file... but you are importing a .csv file. Excel can save a file as a .csv, but then it is no longer an excel file. So is it an excel file or a csv file?
Jared
CE - Microsoft
January 26, 2013 at 1:59 am
This was an excel file... i changed to csv for testing purpose and that is what i posted by mistake...
the DDL of the table:
create table abc(
id int
)
excel file contains only one column with 5 records
1
2
3
4
5
January 26, 2013 at 5:28 am
When you say you "changed it" if you just changed the extension from xls or xlsx to csv then you didn;t change much of anything except the file name. The file is still in Excel format at that point and bcp.exe cannot import Excel-formatted files. You will need to open the Excel file in Excel and then save it as a csv file which will actually change the file format.
If we're still stumbling over terminology you can always check by opening your file in Notepad. If the file is plain-text you'll see your data, else you'll see a garbled mess and you'll know the file is still in Excel format and not a plain-text csv file.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy