Sample A: Enrollment_20081211.txt
Sample B: Enrollment_20081211_01.txt
CODE
declare @date varchar(8)
, @cmd varchar(255)
set @date = REPLACE(CONVERT(VARCHAR,GETDATE()-1,111),'/','')
truncate table bow_flat
select @cmd ='BULK INSERT [1400_byte_layout].dbo.IKA_Flat FROM ''\\test\ArcadianEnrollment_'+@date+'.txt'''
exec (@cmd)
PROCESS
The code above BCP Sample A file into a table based on the current date @date, and this process is fine. But I am having issues with Sample B where the filename has an increment number before the .txt filename, I having difficulty modifying the code above to make it work for sample B.
Your assistance regarding this matter is aprpeciated.
Thanks.