‘necessity is the mother of invention’ - microsoft€¦ · arvind shyamsundar 11 years at...
TRANSCRIPT
1
Arvind Shyamsundar11 years at MicrosoftMicrosoft Certified Master: SQL Server 2008Master Trainer: SQL 2012 PTO; SQL 2012 HA/DR workshopsCreator and global owner: T-SQL Patterns and Practices ReviewSQL Server Risk Assessment Programs (SQLRaaS & SQLRAP) lead, Asia
Contact InformationTwitter: @arvisamBlog: http://aka.ms/arvindsh
2
‘Necessity is the mother of invention’
3
4
http://blogs.msdn.com/b/gertd/archive/2008/08/21/getting-to-the-crown-jewels.aspx
5
6
Feature pack: http://www.microsoft.com/en-us/download/details.aspx?id=35580
7
8
9
http://technet.microsoft.com/en-us/library/microsoft.sqlserver.transactsql.scriptdom.likepredicate_properties.aspx
In the above example, here is how LikePredicate looks:
LikePredicateScalarExpression FirstExpressionScalarExpression SecondExpressionBoolean NotDefinedBoolean OdbcEscapeScalarExpression EscapeExpression
Here is the inheritance graph from ScalarExpression all the way down to StringLiteral:
ScalarExpression -> PrimaryExpression -> ValueExpression -> Literal -> StringLiteral
10
11
12
Analyzing the token stream directly is useful for specific cases such as identifying single line statements etc.
13
14
http://blogs.msdn.com/b/arvindsh/archive/2013/04/04/using-the-transactsql-scriptdom-parser-to-get-statement-counts.aspx
15
16
17
18
19
For example, if we want to find out statements without a WHERE clause, it is tedious to do that with visitor pattern code.
The inspiration for representing the T-SQL AST as XML originates from the older Microsoft.SqlServer.SqlParser.Parser.Parser class, which would emit XML version of the AST.
http://blogs.msdn.com/b/arvindsh/archive/2013/10/30/xml-visualizer-for-the-transactsql-scriptdom-parse-tree.aspx
20
21
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/42702baf-d5f5-401a-b384-c37aeadd3d03/is-using-the-api-to-create-a-diff-script-inherently-slower-than-shelling-sqlpackageexe-sqlcmd?forum=ssdt
22
23
24