SQL2K: BULK INSERT: Check if files exists
Posted on 2003-03-07
I need to check to see if a file exists before I attempt a BULK INSERT in SQL Server 2K. I have tried code *similar* to the following:
INSERT TBL_Export_Tracking FROM 'C:\last.track' WITH (FIELDTERMINATOR = ',' ,ROWTERMINATOR = '\n')
IF @@ERROR <> 0
However, the error routine is not reached SQL Server instead returns and says the file is not found. SS7 had a procedure that could check for the existence of a file, but for soem reason 2000 does not. Any ideas?