Slides and samples for my SQL PASS ScriptDom talk


Thank you very much, PASS AppDev for giving me the chance to share the capabilities and usage of the ScriptDom parser! The session was packed to capacity even before we got underway, something we did not quite expect given the specialized nature of the talk.

Request: if you want to see an ‘encore’ or want more, please leave a comment on this blog, or email the AppDev DL.

Edit 12 Nov 2013: The recording of this session is now available.

Download Samples

Download Slide deck

Disclaimer

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.  THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.  We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.

Comments (5)

  1. Luca Zavarella says:

    Hi Arvind,

    your ScriptDOM knowledge sharing is really appreciated! There are too few infos on the web about this API.

    So, thank you! 🙂

    I'm looking forward to download your session.

    Regards,

    Luca

  2. Jalal says:

    Please provide a sample for generating SQL SELECT statement using this api.

  3. Roelof says:

    I tried the TSQLFormatter sample with this sql statement:

    INSERT INTO TABLE1 ( COL1, COL2) VALUES ( @COL1, @COL2);

    Both options multilineInsertTargetsList and multilineInsertSourcesList are set to true, so I would expect the columns are spread across multiple lines. Instead the output is like this:

    INSERT  INTO TABLE1 (COL1, COL2)

    VALUES             (@COL1, @COL2);

    Do you have any idea why this happen?

  4. bane says:

    Is it possible to change the TSqlFragment after the parser returns it?  For example, could I change the names of the tables in the From clause?

  5. arvindsh says:

    You can definitely change the properties of the classes in the tree. The key thing is to typecast the child nodes in the tree to their 'actual' types. There's actually an example of a similar rewriting capability described in blogs.msdn.com/…/t-sql-formatter-a-powershell-script.aspx