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
 SQL Server Development (2000)
 bcp Problem

Author  Topic 

TAS
Yak Posting Veteran

65 Posts

Posted - 2003-10-24 : 15:22:24
I use the following store procedure to insert a text file to sql table:


Alter Procedure "EmailNameImport"
@FileName varchar(100)
As

Set nocount on
Bulk insert tblTempEmail from 'X:\MyEmail\"+@FileName+"'



I give the parameter @FileName runtime value, but I get error message, which says
"Could not bulk insert because 'X:\MyEmail\"+@FileName+"'could not be opened.Operating system error code 123(The filename, diretory name,or volume label syntax is incorrect.)

Any body can tell why?

ms_sql_dba
Starting Member

3 Posts

Posted - 2003-10-24 : 16:12:49
how about this?

exec ('bulk insert tbl from "x:\dir\'+@FileName+'"')
Go to Top of Page

TAS
Yak Posting Veteran

65 Posts

Posted - 2003-10-27 : 12:16:40
It works. Thanks!
Go to Top of Page
   

- Advertisement -