• Try this for a list of the files:

    create table #T (

    ID int identity primary key,

    FName varchar(256));

    --

    insert into #T (FName)

    exec master..xp_cmdshell 'dir MyTraceDirectory\*.trc /b';

    --

    select *

    from #T;

    You'll have to put in the actual directory, of course.

    Once you have that list, it should be very easy to select everything except the last file, and to load up the trace table from that. It's easier in SQL 2005, because you could construct a simple Except argument, but it's not that difficult in 2000 to set up a comparable outer join or Where Not In.

    That should give you what you need, right?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon