Evaluate the leftmost part of the record returned by this code.
set nocount on
set transaction isolation level read uncommitted
declare @l_vtablename varchar(128)
declare @l_vsqlstring varchar(1024)
declare @p_vdirectory varchar(128)
declare @p_vfilename varchar(128)
set @p_vdirectory = 'directory'
set @p_vfilename = 'filename'
create table #tchecktable (output varchar(512))
set @l_vsqlstring = 'dir ' + @p_vdirectory+@p_vfilename
--populate the table with the directory info
insert into #tchecktable exec master..xp_cmdshell @l_vsqlstring
--strip out everything except the entry for the file
DELETE FROM #tchecktable WHERE output is NULL
OR right(rtrim(output),len(@p_vfilename)) <> @p_vfilename
select * from #tchecktable
drop table #tchecktable
Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.