• Thanks for the suggestions. i am actually not that experienced in sql and your suggestions have helped me advance my skill. thanks. also please see the post about the temporary table. as a matter of interest the code that creates the temp table is in _SPLOG_SPConstructor

    CREATE TABLE #sp

    (

    spid BIGINT IDENTITY(1, 1),

    sptext TEXT NOT NULL,

    spname VARCHAR(100) NOT NULL

    )