HELP! Automating BCP ....passing filenames to SQL Server 
Author Message
 HELP! Automating BCP ....passing filenames to SQL Server
Hi,

is there any way you can pass or read in the filenames from a directory and
pass this back to SQL Server to bcp in with the Xp_cmdshell SP

I would like to automate the bcp but am having problems as the the textfile
name changes daily as the date is used as part of the filename. Ideally I would
like somehow to pass the filemname of the textfile back to SQL Server in a
variable of some sort. is this possible?

Is there an easy way to work around this ...?

any ideas are welcome

thanx in advance...

J.



Mon, 30 Apr 2001 03:00:00 GMT
 HELP! Automating BCP ....passing filenames to SQL Server

Here is sample code with wihch you can get file name from xp_cmdshell.

use pubs
go
create table #tablename (c1 smallint identity, tblname varchar(30) null)
go
insert #tablename (tblname) exec ("master..xp_cmdshell 'dir/b/a:-d c:\'")
go
select * from #tablename
go

William Zhou

Quote:

>Hi,

>is there any way you can pass or read in the filenames from a directory and
>pass this back to SQL Server to bcp in with the Xp_cmdshell SP

>I would like to automate the bcp but am having problems as the the textfile
>name changes daily as the date is used as part of the filename. Ideally I
would
>like somehow to pass the filemname of the textfile back to SQL Server in a
>variable of some sort. is this possible?

>Is there an easy way to work around this ...?

>any ideas are welcome

>thanx in advance...

>J.



Mon, 30 Apr 2001 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Automate Save Report with field name for filename help VFP 5

2. automated backup using different filename

3. bcp parameterize output filename

4. filename in bcp

5. bcp and filename

6. using BCP to copy column data to a unicode filename

7. passing filename to DTS package

8. hOW DO I PASS FILENAME AS A PARAMETER TO DTS

9. Calling a DTS package from an SP passing in a filename

10. Passing a filename to a DTS package

11. HELP -- BCP'ing BIT value into SQL Server using format file

12. BCP SQL SERVER Error Help


 
Powered by phpBB® Forum Software