HELP! Automating BCP ....passing filenames to SQL Server
Here is sample code with wihch you can get file name from xp_cmdshell.
create table #tablename (c1 smallint identity, tblname varchar(30) null)
insert #tablename (tblname) exec ("master..xp_cmdshell 'dir/b/a:-d c:\'")
select * from #tablename
>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
>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...