Thanks for the help, I will keep working on this to see if I can figure it out. Here is the stored procedure:CREATE procedure ImportFiles@FilePath varchar(1000) = 'c:\Transfer\' ,@ArchivePath varchar(1000) = 'c:\Transfer\Archive\' ,@FileNameMask varchar(1000) = '*.txt' ,@MergeProc varchar(128) = 'MergeBCPData'AS set nocount on declare @ImportDate datetime select @ImportDate = getdate() declare @FileName varchar(1000) , @File varchar(1000)declare @cmd varchar(2000) create table ##Import (s varchar(40), a varchar(40), b varchar(40), c varchar(40), d varchar(40), e varchar(40), f varchar(40), g varchar(40), h varchar(40), i varchar(40), j varchar(40), k varchar(40), l varchar(40), m varchar(40), n varchar(40), o varchar(40)) create table #Dir (s varchar(8000)) /*****************************************************************/ -- Import file /*****************************************************************/ select @cmd = 'dir /B ' + @FilePath + @FileNameMask delete #Dir insert #Dir exec master..xp_cmdshell @cmd delete #Dir where s is null or s like '%not found%' while exists (select * from #Dir) begin select @FileName = min(s) from #Dir select @File = @FilePath + @FileName select @cmd = 'bulk insert' select @cmd = @cmd + ' ##Import' select @cmd = @cmd + ' from' select @cmd = @cmd + ' ''' + replace(@File,'"','') + '''' select @cmd = @cmd + ' with (FIELDTERMINATOR= ''\r''' select @cmd = @cmd + ',ROWTERMINATOR = ''['')' truncate table ##Import -- import the data exec (@cmd) print @cmd -- remove filename just imported delete #Dir where s = @FileName exec @MergeProc @filename -- Archive the file select @cmd = 'move ' + @FilePath + @FileName + ' ' + @ArchivePath + @FileName exec master..xp_cmdshell @cmd end drop table ##Import drop table #DirGO