• ok here's one way to do it with SQL2000:

    declare @sql_handle-2 binary(20),@spid smallint;

    declare c1 cursor for select sql_handle,spid from master..sysprocesses where spid >50;

    open c1;

    fetch next from c1 into @sql_handle-2,@spid;

    while (@@FETCH_STATUS =0)

    begin

    select

    spid,

    login_time,

    last_batch,

    [status],

    loginame,

    a.text

    from ::fn_get_sql(@sql_handle) a, master..sysprocesses b

    where b.spid = @spid

    fetch next from c1 into @sql_handle-2,@spid

    end

    close c1

    deallocate c1;

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!