• I would basically do it the same as anthony; they are already in a table, so not temp table or cursor required.

    I kind of like some of the built in functions, so I'd use those for schema/object name:

    select

    OBJECT_SCHEMA_NAME(object_id) AS SchemaName,

    OBJECT_NAME(object_id) AS ObjectName,

    definition AS ObjectDefinition

    FROM sys.sql_modules

    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!