Sunday, February 19, 2012

IN SQL SERVER BCP

Hi,

I have to insert a data from text file to Sql Server Using BULK INSERT ie BCP. Throgh qurey wise it execute fine.
But using stored procedure it does not work..here just i have to pass 1 parameter ie file name. The err is

" Could not bulk insert. File '@.BasicFile' does not exist." How can i solve the prolblem ?

Thanks and Regards,

ArulIt looks like you are trying to use a variable filename for your source file. As far as I know, you will need to use dynamic SQL to accomplish this.


SET @.SQL = "BULK INSERT myTable '"+@.PathFileName+"' WITH (FIELDTERMINATOR = ',') "
EXEC (@.SQL)

Terri

No comments:

Post a Comment