Anyone knows a good script concatenation tool?

  • Hi,

    I've been using some, but they either have a problem with unicode characters or don't have features like putting a separator like "GO" or "Print MyScriptName.sql" between the concatenated scripts.

    So I was wondering if someone could recommend a good one without those problems?

    Thanks.

  • Up! 😎

  • Could you please be a little clearer about what you are looking for? For instance, why isn't SSMS's builtin Script Generator sufficient?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Ok, the starting point for me is when all the objects, tables, FKs, triggers, SPs, etc are scripted into separate files. This can't change, as it is part of the process.

    I need to concatenate all the scripts together into one script. I need the tool which is able to handle not English alphabet characters, e.g. Spanish (some data scripts contain other language text). Idealy I want to be able to insert some lines before and after each file.

    E.g.:

    Print {file name}

    go

    Thats all.

  • Why not re-script them into a single file?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • RBarryYoung (12/10/2009)


    Why not re-script them into a single file?

    This is the process, they have to come from TFS, not from development database.

    Besides, I don't want to re-script them all, only those that are part of the upgrade and are in TFS.

    Besides, it is hard to re-script something like this:

    Alter table MyTable add MyNewColumn...

  • Our environment is identical. I.e., everything is checked in to our source code control system (Perforce) as separate files.

    The attached DOS script (BuildSchema.cmd) will do the job. Yes, it is old and ugly but it was the only technology that I could use at the time. My plan is to rewrite it in PowerShell. But as the old saying goes "if it ain't broke, don't fix it".

    Note that the script is uploaded as a .txt file as the .cmd file extension is not allowed.

    The script uses text files as the "recipe" to build the single "CreateSchema.sql" script. So the "root" (starting) text file looks like:

    # ------------------------------------------------------------------------------

    # This file controls the sequence and list of objects that are

    # to be concatenated together during the schema build process.

    #

    # The sequence is important as errors will occur during the actual

    # schema creation if dependent objects are not present.

    #

    # E.g., FK constraints cannot be created until the related

    # tables have been created.

    #

    # To address dependency loops, E.g., a stored Function or

    # Procedure utilizing a View and Views using stored Functions,

    # multiple [named] ".txt" files are used in the subdirectory

    # structure vs. a single "CreateAll.txt" file.

    #

    # ------------------------------------------------------------------------------

    Scripts\SchemaCreateProlog.txt

    XMLschemas\CreateAll.txt

    Tables\CreateAll.txt

    FKconstraints\CreateAll.txt

    Views\NonFunctionDependent.txt

    Functions\CreateAll.txt

    Procedures\CreateAll.txt

    Triggers\CreateAll.txt

    FullText\CreateAll.txt

    Views\QueryViews.txt

    Constants\CreateAll.txt

    Localizations\CreateAll.txt

    Security\CreateAll.txt

    Scripts\SchemaCreateEpilog.txt

    Then each Directory has a text file such as (for procedures):

    # --------------------------------------------------------------------------------------------------------

    # Caution! Dependencies DO exist! So don't arbitrarily reorder this list.

    # --------------------------------------------------------------------------------------------------------

    # The following MUST come first as it creates the entries.

    CreateAllProcedures.sql

    # Now we fill in the details of each Procedure.

    #

    # start of Windows Workflow Foundation SqlPersistenceService procedures

    InsertInstanceState.sql

    RetrieveAllInstanceDescriptions.sql

    UnlockInstanceState.sql

    ForceUnlockInstanceState.sql

    RetrieveInstanceState.sql

    RetrieveNonblockingInstanceStateIds.sql

    RetrieveANonblockingInstanceStateId.sql

    RetrieveExpiredTimerIds.sql

    InsertCompletedScope.sql

    DeleteCompletedScope.sql

    RetrieveCompletedScope.sql

    # end of Windows Workflow Foundation SqlPersistenceService procedures

    #

    psp_rethrow_error.sql

    psp_Add_user.sql


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]

Viewing 7 posts - 1 through 7 (of 7 total)

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