170 likes | 382 Views
Transact SQL. Principles, Techniques and Peculiarities. Tim Tatum. Transact SQL. Tim Tatum, MBA MCSD Core Consulting Richmond, Virginia. Transact SQL. Principles, Techniques and Peculiarities Fundamentals of Security Preservation of Data Integrity Flexible Design Techniques
E N D
Transact SQL Principles, Techniques and Peculiarities Tim Tatum
Transact SQL Tim Tatum, MBA MCSD Core Consulting Richmond, Virginia
Transact SQL • Principles, Techniques and Peculiarities • Fundamentals of Security • Preservation of Data Integrity • Flexible Design Techniques • Performance Management
Fundamentals of Security • Regular Backups • Principle of Least Privilege • Parameterized Stored Procedures
Preservation of Data Integrity • Bad Data – Transaction Processing • Enforce Referential Integrity • Effective Application Layer Validation • Bad Data – Data Warehouse • Effective Controls • “Defensive” Scripting
Preservation of Data Integrity • Peculiarities • Nulls • Variable Assignments • Useful Techniques • Reconciliation • Forcing 1:1 relationships
Preservation of Data Integrity • Nulls • Nulls and Joins • Comparisons • Null Math/Concatenation
Preservation of Data Integrity • Variable Assignments • Within Select Statements – No Rows • Within Select Statements – Multiple Rows • Assignments, Data Types and Isnull()
Preservation of Data Integrity • Useful Techniques • Reconciliation • Forcing 1:1 Relationships
Flexible Design Techniques • Dynamic SQL • sp_executesql • exec()
Managing Performance • Using Indexes Effectively • Writing Queries that Perform Well
Managing Performance • Using Indexes Effectively • Developing an Indexing Strategy • Maintaining Indexes
Managing Performance • Using Indexes Effectively • Developing an Indexing Strategy • Execution Plan • Seek • Scan • Using SQL Profiler • Revisit Strategies as Data Grows
Managing Performance • Maintaining Indexes • Manage Fragmentation • Update Statistics
Managing Performance • Writing Queries that Perform Well • Use Stored Procedures • Set nocount on • Use (nolock) on All Select Queries • Substitute Joins for Subqueries • Select Only the Columns You Need • Handle String Manipulation Carefully • Avoid Implicit Conversions
Managing Performance • Writing Queries that Perform Well • Try to Avoid • IN • NOT IN • NOT Exists • NOT Like • Like ‘%value’ • <> • != • OR
Transact SQL • Principles, Techniques and Peculiarities • Fundamentals of Security • Preservation of Data Integrity • Flexible Design Techniques • Performance Management