Stairway to ScriptDOM Level 2 - Parsing, Tokens, and the Abstract Syntax Tree

  • Comments posted to this topic are about the item Stairway to ScriptDOM Level 2 - Parsing, Tokens, and the Abstract Syntax Tree

  • Hi

    very nice. Many thanks for the explanations.

    One question: how can something be added later in the procedure?


    a missing block:

    Insert Into Table_2(Field_1,Field_2,Field_3)
    Select field_1,field_2,field_3
    from table_1


    Frank Kress

  • Hi Frank , yes you can add stuff and I will be explaining that in later examples but it may be a little more complex that we think.

    Thank you for reading.

  • Some things in Azure Synapse don't exist or work the same compared to "regular" TSQL. I usually find at some point I need to find out what distinct objects (tables, views, functions) a given view, proc or function might need. In Synapse, sys.dependencies only works for views and the tables or views they use.

    So that leaves doing something with the code in the source code system tables/views...

    It's easy enough nowdays to "split" each object's source code text blob in sys.sql_modules and do some simple pattern-matching on those.  But since TSQL (still) doesn't have real regular expressions available out-of-the-box, doing much more with TSQL string functions gets onerous quickly, and any kind of weird code formatting will be painful to work with (one-liner queries or joins, say).

    So this series looks to be quite useful to me in my world, and available to help with other things that may contain TSQL queries or code that might need to have this info extracted, whether said code is in a database or external, like within source control files, or embedded SQL in SSIS packages or SSRS reports. Huzzah for MS for making it, and those who've figured out how to use it. Now if only there were similar .Net DLLs for Oracle PL/SQL, and so on...

  • Am very glad to hear that it is useful! Thanks for the comment. Yeah this is just a t-sql library and one that has been around a very long time. Am not sure we will get similar for other SQL languages..maybe if more people ask for it it may happen.

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

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