SlideShare a Scribd company logo
Advanced T-SQL Querying and Programming  Inside SQL Server Vinod Kumar M Technology Evangelist – Microsoft www.ExtremeExperts.com @vinodk_sql 20 / 04 / 10
Session Objectives SQL Server is an ocean and this session will show some of the interesting feature usages with SQL Server These are my explorations with SQL Server but not exhaustive You will learn some of these tricks and concepts with easy examples
Common Worst Practices Technology for technology’s sake Excitement over new features instead of leveraging the  right  new features ( or the real benefits of them ) Using default options – expecting them to be ideal for all purposes Database creation, table creation, index creation… Transact-SQL and stored procedure creation Myths, folklore and “advice” from limited tests  (the wrong solution for the wrong problem) Lack of database maintenance Fragmentation, statistics, disaster recovery…
Agenda !!! Introduction  T-SQL with SQL Server 2008 Demo, Demo and more Demo’s
T-SQL Enhancements in  SQL Server 2008
Techniques, Tips & Tricks As time permits… SELECT 'Mostly  Code';
Techniques, Tips & Tricks As time permits… 0. Wake Up time   1. Uniqueness with Multiple NULLs 2. Sort Strings with Separated Values 3. Date and Time Calculations 4. Custom Sequence 5. String defaults 6. Row Numbers with no Ordering 7. Recompiling at Statement Level
Summary !!! Keep an eye on different modes of operations and new features introduced. There are many more that we couldn’t cover this time inside each of these Keep exploring different ways to work with SQL Server and it will be fun !!!
Q&A www.ExtremeExperts.com http://blogs.sqlxml.org/vinodkumar @vinodk_sql
Ad

Recommended

Uncovering SQL Server query problems with execution plans - Tony Davis
Uncovering SQL Server query problems with execution plans - Tony Davis
Red Gate Software
 
SQL Server Query Optimization, Execution and Debugging Query Performance
SQL Server Query Optimization, Execution and Debugging Query Performance
Vinod Kumar
 
Why & how to optimize sql server for performance from design to query
Why & how to optimize sql server for performance from design to query
Antonios Chatzipavlis
 
An Approach to Sql tuning - Part 1
An Approach to Sql tuning - Part 1
Navneet Upneja
 
Query Optimization in SQL Server
Query Optimization in SQL Server
Rajesh Gunasundaram
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
Kevin Kline
 
Oracle SQL Tuning
Oracle SQL Tuning
Alex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
Alex Zaballa
 
Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
Alex Zaballa
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
Mark Ginnebaugh
 
Performance tuning in sql server
Performance tuning in sql server
Antonios Chatzipavlis
 
Oracle DB Performance Tuning Tips
Oracle DB Performance Tuning Tips
Asanka Dilruk
 
SQL Server Optimization Checklist
SQL Server Optimization Checklist
Grant Fritchey
 
Unit Testing SQL Server
Unit Testing SQL Server
Giovanni Scerra ☃
 
Stored procedure tuning and optimization t sql
Stored procedure tuning and optimization t sql
nishantdavid9
 
Sql server performance tuning and optimization
Sql server performance tuning and optimization
Manish Rawat
 
Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)
Guy Harrison
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
High Performance Plsql
High Performance Plsql
Guy Harrison
 
Oracle Database 12c - Data Redaction
Oracle Database 12c - Data Redaction
Alex Zaballa
 
Oracle Data Redaction
Oracle Data Redaction
Alex Zaballa
 
SQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First Time
Dean Richards
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14
Alex Zaballa
 
Beginners guide to_optimizer
Beginners guide to_optimizer
Maria Colgan
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
Alex Zaballa
 
Web application penetration using SQLMAP.
Web application penetration using SQLMAP.
asmitaanpat
 
Oracle’ın parallel execution yetenekleri ve performans
Oracle’ın parallel execution yetenekleri ve performans
Emrah METE
 
Microsoft sql server 2012
Microsoft sql server 2012
Taqui Wajuyat Flor
 
Top 9 t sql interview questions answers
Top 9 t sql interview questions answers
jonhmart036
 

More Related Content

What's hot (20)

Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
Alex Zaballa
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
Mark Ginnebaugh
 
Performance tuning in sql server
Performance tuning in sql server
Antonios Chatzipavlis
 
Oracle DB Performance Tuning Tips
Oracle DB Performance Tuning Tips
Asanka Dilruk
 
SQL Server Optimization Checklist
SQL Server Optimization Checklist
Grant Fritchey
 
Unit Testing SQL Server
Unit Testing SQL Server
Giovanni Scerra ☃
 
Stored procedure tuning and optimization t sql
Stored procedure tuning and optimization t sql
nishantdavid9
 
Sql server performance tuning and optimization
Sql server performance tuning and optimization
Manish Rawat
 
Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)
Guy Harrison
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
High Performance Plsql
High Performance Plsql
Guy Harrison
 
Oracle Database 12c - Data Redaction
Oracle Database 12c - Data Redaction
Alex Zaballa
 
Oracle Data Redaction
Oracle Data Redaction
Alex Zaballa
 
SQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First Time
Dean Richards
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14
Alex Zaballa
 
Beginners guide to_optimizer
Beginners guide to_optimizer
Maria Colgan
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
Alex Zaballa
 
Web application penetration using SQLMAP.
Web application penetration using SQLMAP.
asmitaanpat
 
Oracle’ın parallel execution yetenekleri ve performans
Oracle’ın parallel execution yetenekleri ve performans
Emrah METE
 
Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
Alex Zaballa
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
Mark Ginnebaugh
 
Oracle DB Performance Tuning Tips
Oracle DB Performance Tuning Tips
Asanka Dilruk
 
SQL Server Optimization Checklist
SQL Server Optimization Checklist
Grant Fritchey
 
Stored procedure tuning and optimization t sql
Stored procedure tuning and optimization t sql
nishantdavid9
 
Sql server performance tuning and optimization
Sql server performance tuning and optimization
Manish Rawat
 
Top 10 tips for Oracle performance (Updated April 2015)
Top 10 tips for Oracle performance (Updated April 2015)
Guy Harrison
 
Oracle performance tuning_sfsf
Oracle performance tuning_sfsf
Mao Geng
 
High Performance Plsql
High Performance Plsql
Guy Harrison
 
Oracle Database 12c - Data Redaction
Oracle Database 12c - Data Redaction
Alex Zaballa
 
Oracle Data Redaction
Oracle Data Redaction
Alex Zaballa
 
SQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First Time
Dean Richards
 
Oracle Data Redaction - UKOUG - TECH14
Oracle Data Redaction - UKOUG - TECH14
Alex Zaballa
 
Beginners guide to_optimizer
Beginners guide to_optimizer
Maria Colgan
 
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
Alex Zaballa
 
Web application penetration using SQLMAP.
Web application penetration using SQLMAP.
asmitaanpat
 
Oracle’ın parallel execution yetenekleri ve performans
Oracle’ın parallel execution yetenekleri ve performans
Emrah METE
 

Viewers also liked (7)

Microsoft sql server 2012
Microsoft sql server 2012
Taqui Wajuyat Flor
 
Top 9 t sql interview questions answers
Top 9 t sql interview questions answers
jonhmart036
 
TSQL Advanced Query Techniques
TSQL Advanced Query Techniques
Gianluca Sartori
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
Lukas Eder
 
MS Sql Server: Advanced Query Concepts
MS Sql Server: Advanced Query Concepts
DataminingTools Inc
 
Product life cycle
Product life cycle
Vandna Dhiman
 
Software Product Life Cycle
Software Product Life Cycle
Mahesh Panchal
 
Top 9 t sql interview questions answers
Top 9 t sql interview questions answers
jonhmart036
 
TSQL Advanced Query Techniques
TSQL Advanced Query Techniques
Gianluca Sartori
 
10 SQL Tricks that You Didn't Think Were Possible
10 SQL Tricks that You Didn't Think Were Possible
Lukas Eder
 
MS Sql Server: Advanced Query Concepts
MS Sql Server: Advanced Query Concepts
DataminingTools Inc
 
Software Product Life Cycle
Software Product Life Cycle
Mahesh Panchal
 
Ad

Similar to Advanced t sql - querying and programming inside sql server (20)

SQL Server Tips & Tricks
SQL Server Tips & Tricks
Ike Ellis
 
SQL Pass Architecture SQL Tips & Tricks
SQL Pass Architecture SQL Tips & Tricks
Ike Ellis
 
Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014
Ike Ellis
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
nkarag
 
SQL Server Worst Practices - EN
SQL Server Worst Practices - EN
Gianluca Sartori
 
MySQL 5.7 como Document Store
MySQL 5.7 como Document Store
MySQL Brasil
 
ow.ppt
ow.ppt
ssuser96a63c
 
ow.ppt
ow.ppt
NalamalpuBhakthavats
 
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
Brahamam Veera
 
Ow
Ow
AlbertoItzincab1
 
Salesforce Development Best Practices
Salesforce Development Best Practices
Vivek Chawla
 
Backpack Tools4 Sql Dev
Backpack Tools4 Sql Dev
Gonçalo Chaves
 
ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123
DngHong855117
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developers
Ike Ellis
 
CSE311_IAH_Slide06_SQL _Retrival_Queries.pptx
CSE311_IAH_Slide06_SQL _Retrival_Queries.pptx
noshinnawar31
 
Sql server common interview questions and answers
Sql server common interview questions and answers
Kaing Menglieng
 
SQL Tips + Tricks for Developers
SQL Tips + Tricks for Developers
VictorSzoltysek
 
Breaking data
Breaking data
Terry Bunio
 
Using T-SQL
Using T-SQL
Antonios Chatzipavlis
 
SQL Tuning 101
SQL Tuning 101
Carlos Sierra
 
SQL Server Tips & Tricks
SQL Server Tips & Tricks
Ike Ellis
 
SQL Pass Architecture SQL Tips & Tricks
SQL Pass Architecture SQL Tips & Tricks
Ike Ellis
 
Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014
Ike Ellis
 
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
Oracle SQL Tuning for Day-to-Day Data Warehouse Support
nkarag
 
SQL Server Worst Practices - EN
SQL Server Worst Practices - EN
Gianluca Sartori
 
MySQL 5.7 como Document Store
MySQL 5.7 como Document Store
MySQL Brasil
 
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
kjdiakdnfdifjadsjkjklljlldasgjdjdljgfldjgldjgldjgl.ppt
Brahamam Veera
 
Salesforce Development Best Practices
Salesforce Development Best Practices
Vivek Chawla
 
ow-123123123123123123123123123123123123123
ow-123123123123123123123123123123123123123
DngHong855117
 
Top 5 things to know about sql azure for developers
Top 5 things to know about sql azure for developers
Ike Ellis
 
CSE311_IAH_Slide06_SQL _Retrival_Queries.pptx
CSE311_IAH_Slide06_SQL _Retrival_Queries.pptx
noshinnawar31
 
Sql server common interview questions and answers
Sql server common interview questions and answers
Kaing Menglieng
 
SQL Tips + Tricks for Developers
SQL Tips + Tricks for Developers
VictorSzoltysek
 
Ad

More from Vinod Kumar (6)

Backup beyond just a strategy with SQL Server
Backup beyond just a strategy with SQL Server
Vinod Kumar
 
Choosing a concurrency model, optimistic or pessimistic
Choosing a concurrency model, optimistic or pessimistic
Vinod Kumar
 
Choosing A Concurrency Model, Optimistic Or Pessimistic
Choosing A Concurrency Model, Optimistic Or Pessimistic
Vinod Kumar
 
Sql Server Security
Sql Server Security
Vinod Kumar
 
Windows Mobile 5.0 Data Access And Storage Webcast
Windows Mobile 5.0 Data Access And Storage Webcast
Vinod Kumar
 
Protecting Your Key Asset – Data Protection Best Practices V2.0 Final
Protecting Your Key Asset – Data Protection Best Practices V2.0 Final
Vinod Kumar
 
Backup beyond just a strategy with SQL Server
Backup beyond just a strategy with SQL Server
Vinod Kumar
 
Choosing a concurrency model, optimistic or pessimistic
Choosing a concurrency model, optimistic or pessimistic
Vinod Kumar
 
Choosing A Concurrency Model, Optimistic Or Pessimistic
Choosing A Concurrency Model, Optimistic Or Pessimistic
Vinod Kumar
 
Sql Server Security
Sql Server Security
Vinod Kumar
 
Windows Mobile 5.0 Data Access And Storage Webcast
Windows Mobile 5.0 Data Access And Storage Webcast
Vinod Kumar
 
Protecting Your Key Asset – Data Protection Best Practices V2.0 Final
Protecting Your Key Asset – Data Protection Best Practices V2.0 Final
Vinod Kumar
 

Recently uploaded (20)

TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
High Availability On-Premises FME Flow.pdf
High Availability On-Premises FME Flow.pdf
Safe Software
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 

Advanced t sql - querying and programming inside sql server

  • 1. Advanced T-SQL Querying and Programming Inside SQL Server Vinod Kumar M Technology Evangelist – Microsoft www.ExtremeExperts.com @vinodk_sql 20 / 04 / 10
  • 2. Session Objectives SQL Server is an ocean and this session will show some of the interesting feature usages with SQL Server These are my explorations with SQL Server but not exhaustive You will learn some of these tricks and concepts with easy examples
  • 3. Common Worst Practices Technology for technology’s sake Excitement over new features instead of leveraging the right new features ( or the real benefits of them ) Using default options – expecting them to be ideal for all purposes Database creation, table creation, index creation… Transact-SQL and stored procedure creation Myths, folklore and “advice” from limited tests (the wrong solution for the wrong problem) Lack of database maintenance Fragmentation, statistics, disaster recovery…
  • 4. Agenda !!! Introduction T-SQL with SQL Server 2008 Demo, Demo and more Demo’s
  • 5. T-SQL Enhancements in SQL Server 2008
  • 6. Techniques, Tips & Tricks As time permits… SELECT 'Mostly Code';
  • 7. Techniques, Tips & Tricks As time permits… 0. Wake Up time  1. Uniqueness with Multiple NULLs 2. Sort Strings with Separated Values 3. Date and Time Calculations 4. Custom Sequence 5. String defaults 6. Row Numbers with no Ordering 7. Recompiling at Statement Level
  • 8. Summary !!! Keep an eye on different modes of operations and new features introduced. There are many more that we couldn’t cover this time inside each of these Keep exploring different ways to work with SQL Server and it will be fun !!!

Editor's Notes

  • #6: 04/21/10 10:21 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.