rss2
asked on
BCP format file? Syntax error?
Hi Experts,
I'm trying to create a format file from a table, to be used in the Bulk Insert Task of a step in an SSIS package I'm building.
The reason I want to use a format file is because I need to import a very large csv file every day into the database (hence the use of the Bulk Insert rather than normal Data Flow), and I notice the csv file is sometimes incomplete. Sometimes the last line of the file just ends abruptly.
While that needs to be fixed, that's not my problem. And I must pull in all the data regardless of things like that.. at least for now.
So I thought a format file would do the trick. Am I right? If not, what do you think?
On the database server itself, I run this line and get a syntax error:
bcp Diamond.dbo.STG_CUSTOMERCO MPLAINTS_B IT format nul -c -f "w:\testformat.fmt" -S cnwp0145 -T
The syntax error is attached.
I can't figure out what I'm doing wrong here. Could you help me?
Thank you,
rss2
I'm trying to create a format file from a table, to be used in the Bulk Insert Task of a step in an SSIS package I'm building.
The reason I want to use a format file is because I need to import a very large csv file every day into the database (hence the use of the Bulk Insert rather than normal Data Flow), and I notice the csv file is sometimes incomplete. Sometimes the last line of the file just ends abruptly.
While that needs to be fixed, that's not my problem. And I must pull in all the data regardless of things like that.. at least for now.
So I thought a format file would do the trick. Am I right? If not, what do you think?
On the database server itself, I run this line and get a syntax error:
bcp Diamond.dbo.STG_CUSTOMERCO
The syntax error is attached.
I can't figure out what I'm doing wrong here. Could you help me?
Thank you,
rss2
ASKER
I ran it from the command line on the server..
bcp Diamond.dbo.STG_CUSTOMERCO MPLAINTS_B IT format nul -c -f "w:\testformat.fmt" -S cnwp0145 -T
bcp Diamond.dbo.STG_CUSTOMERCO
could you please show the screenshot, with the full error?
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Looks like I was using the Sybase version of bcp.
Here is the result of using SQL Server 2008's bcp (screen shot attached).
Thank you for your help!!!!
bcp-syntax-error-II.JPG
Here is the result of using SQL Server 2008's bcp (screen shot attached).
Thank you for your help!!!!
bcp-syntax-error-II.JPG
your error is now "cannot open host format file"
which means, the file w:\testformat.fmt is not accessible.
which means, the file w:\testformat.fmt is not accessible.
ASKER
spot on
from the SQL Server Query tool, or from the OS command line?
it must be the OS command line tool, as BCP is NOT a SQL or T-SQL command, but a command line tool (bcp.exe) ...