• jancas08 (2/27/2013)


    Okay I will simplify my steps:

    The TEST ddl is the data that has commands that specify changes to the tables.

    My objective is to do those specified commands which can either be insert update or delete.

    The TEST ddl has a column named COMMAND which will have insert update or delete.

    The TEST ddl has a column named ERRORMESSAGE; this specifies which table to run the commands on.

    So, my rules are:

    O14* dictates use of FOURTEEN_ALL table

    HH* dictates use of HH_ALL table

    HL* dictates use of HH_LISTING table

    ED* dicatates use of EDUCATION table

    All that I am to do is run the commands and display what commands are being executed.

    OK now I understand what you are after. Can you post some sample data for test so I have something to work with?

    By my count you have 4 possible tables each with a possible 3 commands. That means you would need to have 12 queries similar to my first post.

    How many rows are in the test table during a typical run?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/