Hello All,
I have a stored procedure that uses a bulk insert to insert records into a table from a dynamically produced text file name.
SET @FileName = "\\server\frompack\WT" + @MachineCounter + @MonthCounter + @DayCounter + ".txt"
Select @SQL = 'Bulk Insert #Temp '
Select @SQL = @SQL + 'From "' + @FileName + '"'
Select @SQL = @SQL + 'With ( FIELDTERMINATOR = "," , ROWTERMINATOR = "\n" , KEEPNULLS )'
Exec (@SQL)
The problem is... how do verify that the text file exists before I execute the bulk insert?
Any help would be appreciated,
ssmat
I have a stored procedure that uses a bulk insert to insert records into a table from a dynamically produced text file name.
SET @FileName = "\\server\frompack\WT" + @MachineCounter + @MonthCounter + @DayCounter + ".txt"
Select @SQL = 'Bulk Insert #Temp '
Select @SQL = @SQL + 'From "' + @FileName + '"'
Select @SQL = @SQL + 'With ( FIELDTERMINATOR = "," , ROWTERMINATOR = "\n" , KEEPNULLS )'
Exec (@SQL)
The problem is... how do verify that the text file exists before I execute the bulk insert?
Any help would be appreciated,
ssmat