• this works using the top method

    i have used a query to pick the top column from each table in the database - replace with your own table names and foreign keys

    create table #mytemptable ..... (add in table design here)

    declare @sysid int

    declare curs1 cursor for select id from sysobjects

    open curs1

    fetch next from curs1 into @sysid

    while @@fetch_status=0

    begin

    insert into #mytemptable select @sysid,(select top 1 name from syscolumns where id=@sysid)

    fetch next from curs1 into @sysid

    end

    close curs1

    deallocate curs1

    select * from #mytemptable

    drop table #mytemptable

    MVDBA