Consolidated SQL Script

  • Hello,

    I have approximately 200 .sql scripts of stored procedures. Any way i can create a consolidated script of all from these individual scripts?

  • Do you mean view all the scripts collectively?

    Right click on the database

    Tasks -> Generate Scripts

    Just pick Stored Procedures

    - Damian

  • not from the ssms.. wanted from the individual scripts.

    Tried through DOS command.. Its done. Thanks a lot

  • I'm sure there are many ways to skin this cat. Initial approaches:

    In SSMS, i would query sys.sql_modules and paste the query results into a single file.

    select sm.definition

    from sys.sql_modules sm

    inner join sys.objects so on sm.object_id = so.object_id

    where so.type = 'p'

    order by sm.object_id;

    In the file system, I would use the type command to consolidate them into one file.

    type *.sql > consolidated.sql

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply