SlideShare une entreprise Scribd logo
1  sur  36
SQL Server 2008 for
Developers
http://johnsterrett.com/
John Sterrett, @JohnSterrett
About Me!

                                • Working with SQL Server
                                  since 2006
                                • Production DBA for 2
                                  Years
                                • Responsible for 50
• Reside in Wheeling,             Production instances with
  WV (Pittsburgh, PA)             1250 Databases
• Syndicated Blogger            • .NET Developer for 3
  on SQLServerPedia               Years
• Writer for
                                • Built a few Data Marts
  MSSQLTIPS.com

 Session Code • Session Title
Topics to Cover…..
 •   Management Studio (SSMS) Enhancements
 •   T-SQL Delighters
 •   Filtered Indexes
 •   New Date and Time Data Types
 •   Table-Valued Parameters
 •   MERGE statement
 •   Policy Based Management
 •   Change Data Capture




Session Code • Session Title
Management Studio Enhancements
 •      IntelliSense
 •      Debugging
 •      Error List
 •      Object Explorer Details Viewer
 •      Template Explorer
 •      Activity Monitor




Session Code • Session Title
Transact-SQL Delighters
 • Declare and Initialize Variables
 • Compound assignment Operators
 • Table Value Constructor Support through the
   VALUES Clause




Session Code • Session Title
DEMO!!!
 Demo covering The following topics
 • IntelliSense
 • Debugging
 • Error Lists
 • Object Explorer Details
 • Template Explorer
 • Activity Monitor




Session Code • Session Title
Filtered Indexes!
 Have you ever wanted to create an index that filters
 between a static search criteria?

 CREATE INDEX idxName ON Schema.Table
 (Column) WHERE ……




Session Code • Session Title
Filtered Indexes!
 • Improved query performance and plan quality if
   used correctly!
 • Reduced index maintenance costs
 • Reduced index storage costs




Session Code • Session Title
DEMO
 Filtered Indexes Demo….




Session Code • Session Title
New Date & Time Types

 • SQL Server 2008 extends date/time support
 • Larger Value Space
        –   Current DATETIME - 1753-9999 Years
        –   Current DATETIME - 0.00333 Second Accuracy
        –   New Date Types - 0001-9999 Years
        –   New Date/Time Types - Precisions to 100
            nanoseconds
 • Variable Precision Saves Space
 • Separate Date and Time Saves Space
 • ANSI Compatible


Session Code • Session Title
Date and Time
 DATE Data Type
 • Date Only
 • 01-01-0001 to 31-12-9999 Gregorian Calendar

 TIME Data Type
 • Time Only
 • Variable Precision - 0 to 7 decimal places for seconds
 • To 100 nanoseconds




Session Code • Session Title
DATETIME2 & DATETIMEOFFSET
 DATETIME2 Data Type
 • 01-01-0001 to 31-12-9999 Gregorian Calendar
 • Variable Precision - to 100 nanoseconds

 DATETIMEOFFSET
 •   01-01-0001 to 31-12-9999 Gregorian Calendar
 •   Variable Precision - to 100 nanoseconds
 •   Time Zone Offset (From UTCTime) Preserved
 •   Not Time Zone Aware - No Daylight Saving Time Support




Session Code • Session Title
DATETIMEOFFSET
 • SWITCHOFFSET (DATETIMEOFFSET,
   time_zone)
     •      Allows you to change time zones

 • SqlDbType.DateTimeOffset




Session Code • Session Title
Demo!!
 T-SQL Date and Time
 DATETIMEOFFSET with .NET




Session Code • Session Title
Table-Value Parameters
 Have you wished that you could send a table into a
 stored procedure?

 Do you wish you could send all parent-child
 relationship data in one round-trip?




Session Code • Session Title
Table Types
 SQL Server has table variables
 • DECLARE @t TABLE (id int);
 SQL Server 2008 adds strongly typed table
 variables
 • CREATE TYPE mytab AS TABLE (id int);
   DECLARE @t mytab;
 Table-Value Parameters must use strongly typed
 table variables




Session Code • Session Title
Things to know about TVP
 ADO.NET 3.5 Supports Table Value Parameters
 You can populate TVP from the following .NET
 objects
 • DataTable
 • DbDataReader
 • System.Collections.Generic.IList <SQLDataRecord>
 Recommended for 1000 or less records




Session Code • Session Title
TVP with .NET
 SqlParameter tvpParam = new SqlParameter();
     tvpParam.ParameterName = "@TVP";
     tvpParam.Value = dtList; //DataTable in this example
     tvpParam.SqlDbType = SqlDbType.Structured; // This data type allows us
    to pass a table into DB Objects
     tvpParam.TypeName = "TVPComponentType"; // Name of strong typed
    (table type)




Session Code • Session Title
Demo!!
 Table-Value Parameters with T-SQL
 Table-Value Parameters with ASP.NET (C#)




Session Code • Session Title
MERGE!!!
 TRUNCATE TABLE db1.dbo.fool
 INSERT INTO db1.dbo.fool
 SELECT * FROM db2.dbo.fool




Session Code • Session Title
Merge Statement
 Multiple set operations in a single SQL statement
 Uses multiple sets as input
 • MERGE target USING source ON ...
 Operations can be INSERT, UPDATE, DELETE
 Operations based on
 • WHEN MATCHED
 • WHEN [TARGET] NOT MATCHED
 • WHEN SOURCE NOT MATCHED
 ANSI SQL 2006 compliant - with extensions


Session Code • Session Title
More on MERGE
 Multiple WHEN clauses possible
 • For MATCHED and SOURCE NOT MATCHED
 • Only one WHEN clause for TARGET NOT MATCHED
 MERGE can be used with any table source
 A MERGE statement causes triggers to be fired
 once
 Rows affected includes total rows affected by all
 clauses




Session Code • Session Title
MERGE Performance
 MERGE statement is transactional
 • No explicit transaction required
 One Pass Through Tables
 •   At most a full outer join
 •   Matching rows = when matched
 •   Left-outer join rows = when target not matched
 •   Right-outer join rows = when source not matched




Session Code • Session Title
DEMO!!
 Demo Merge with T-SQL!




Session Code • Session Title
Central Management System (CMS) &
 Policy Based Management
 Have you ever wanted to run a script against all
 production databases?

 Have you ever wanted to enforce naming
 conventions in SQL Programming?




Session Code • Session Title
CMS and PBM
 • Central Management System
     •      Needs only 1 instance of SQL 2008
     •      Reactive not proactive
     •      great tool for updating objects on multiple servers

 • Policy Based Management
     •      proactive tool prevents stuff from happening
     •      great tool to enforce compliance on SQL 2008+ servers




Session Code • Session Title
Policy Based Management
 • Facets
 • Conditions
 • Policies




Session Code • Session Title
DEMO!
 Demo monitoring and enforcing naming standards
 with Policy Based Management




Session Code • Session Title
Change Data Capture
 Have you ever wanted to get row deltas on a table
 without using triggers on the source table?




Session Code • Session Title
Enable Change Data Capture
 • Must have Enterprise Edition
 • Uses transaction log to pull deltas
 • Enable on database (req sysadmin)
     •       sys.sp_cdc_enable_db_change_data_capture
         •      creates cdc schema
         •      creates cdc user
         •      creates system tables with cdc schema
 • Enable on table(s) (req db_owner)
     •       sys.sp_cdc_enable_table
         •      creates sql agent jobs
         •      creates table cdc.schema_tablename_CT


Session Code • Session Title
Change Data Capture data
 • Changes stored in cdc.schema_tablename_CT
 • _$operation column specifies change type
     •      1 = DELETE
     •      2 = INSERT
     •      3 = BEFORE UPDATE
     •      4 = AFTER UPDATE




Session Code • Session Title
Querying Change data
 • cdc.fn_cdc_get_all_changes<capture_instance>
     •      gets all changes during specific range
 • cdc.fn_cdc_get_net_changes<capture_instance>
     •      returns final (net change) for each row in the specific
            range




Session Code • Session Title
SSIS with CDC




Session Code • Session Title
DEMO!
 Enable and use Change Data Capture




Session Code • Session Title
How do you get started?
 Using the Transact-SQL Debugger
 SQL 2008 JumpStart
 MSDN – SQL 2008 Virtual Labs
 Developer Fundamentals Part 1: Uncovering T-SQL
 on SQL Server 2008




Session Code • Session Title
Thank you
for attending this session and the
2010 PASS Summit in Seattle

Contenu connexe

Tendances

Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTSolidify
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowBob Ward
 
How SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the GameHow SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the GamePARIKSHIT SAVJANI
 
Microsoft Azure, My First IaaS
Microsoft Azure, My First IaaSMicrosoft Azure, My First IaaS
Microsoft Azure, My First IaaSJohn Martin
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and dockerBob Ward
 
Is SQLcl the Next Generation of SQL*Plus?
Is SQLcl the Next Generation of SQL*Plus?Is SQLcl the Next Generation of SQL*Plus?
Is SQLcl the Next Generation of SQL*Plus?Zohar Elkayam
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBob Ward
 
SPCA2013 - Windows Azure for SharePoint People
SPCA2013 - Windows Azure for SharePoint PeopleSPCA2013 - Windows Azure for SharePoint People
SPCA2013 - Windows Azure for SharePoint PeopleNCCOMMS
 
SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?Zohar Elkayam
 
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudTobias Koprowski
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 noveltiesMSDEVMTL
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should KnowSQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should KnowBob Ward
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum versionsqlserver.co.il
 
Best Practice SharePoint Architecture
Best Practice SharePoint ArchitectureBest Practice SharePoint Architecture
Best Practice SharePoint ArchitectureMichael Noel
 
Brk3043 azure sql db intelligent cloud database for app developers - wash dc
Brk3043 azure sql db   intelligent cloud database for app developers - wash dcBrk3043 azure sql db   intelligent cloud database for app developers - wash dc
Brk3043 azure sql db intelligent cloud database for app developers - wash dcBob Ward
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationJason Stangroome
 
SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4Gianluca Hotz
 
SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2Gianluca Hotz
 

Tendances (20)

Meetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDTMeetup developing building and_deploying databases with SSDT
Meetup developing building and_deploying databases with SSDT
 
SQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should KnowSQL Server R Services: What Every SQL Professional Should Know
SQL Server R Services: What Every SQL Professional Should Know
 
How SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the GameHow SQL Server 2016 SP1 Changes the Game
How SQL Server 2016 SP1 Changes the Game
 
Microsoft Azure, My First IaaS
Microsoft Azure, My First IaaSMicrosoft Azure, My First IaaS
Microsoft Azure, My First IaaS
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and docker
 
Is SQLcl the Next Generation of SQL*Plus?
Is SQLcl the Next Generation of SQL*Plus?Is SQLcl the Next Generation of SQL*Plus?
Is SQLcl the Next Generation of SQL*Plus?
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
 
SPCA2013 - Windows Azure for SharePoint People
SPCA2013 - Windows Azure for SharePoint PeopleSPCA2013 - Windows Azure for SharePoint People
SPCA2013 - Windows Azure for SharePoint People
 
SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?
 
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloudKoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
KoprowskiT_SQLRelay2014#8_Birmingham_FromPlanToBackupToCloud
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
 
The RDBMS You Should Be Using
The RDBMS You Should Be UsingThe RDBMS You Should Be Using
The RDBMS You Should Be Using
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should KnowSQL Server In-Memory OLTP: What Every SQL Professional Should Know
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum version
 
Best Practice SharePoint Architecture
Best Practice SharePoint ArchitectureBest Practice SharePoint Architecture
Best Practice SharePoint Architecture
 
Brk3043 azure sql db intelligent cloud database for app developers - wash dc
Brk3043 azure sql db   intelligent cloud database for app developers - wash dcBrk3043 azure sql db   intelligent cloud database for app developers - wash dc
Brk3043 azure sql db intelligent cloud database for app developers - wash dc
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State Configuration
 
SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4SQL Server 2019 CTP2.4
SQL Server 2019 CTP2.4
 
SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2SQL Server 2019 ctp2.2
SQL Server 2019 ctp2.2
 
Understanding indices
Understanding indicesUnderstanding indices
Understanding indices
 

Similaire à SQL Server 2008 For Developers

Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptxLuisManuelUrbinaAmad
 
Exciting Features for SQL Devs in SQL 2012
Exciting Features for SQL Devs in SQL 2012Exciting Features for SQL Devs in SQL 2012
Exciting Features for SQL Devs in SQL 2012Brij Mishra
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the DatabaseMichaela Murray
 
Sap bods Training in Hyderabad | Sap bods Online Training
Sap bods Training in Hyderabad | Sap bods  Online Training Sap bods Training in Hyderabad | Sap bods  Online Training
Sap bods Training in Hyderabad | Sap bods Online Training CHENNAKESHAVAKATAGAR
 
Sap bods training in hyderabad
Sap bods training in hyderabadSap bods training in hyderabad
Sap bods training in hyderabadRajitha D
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 
World2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewWorld2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewFarah Omer
 
A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!Aaron King
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewKenny Buntinx
 
Columnstore indexes in sql server 2014
Columnstore indexes in sql server 2014Columnstore indexes in sql server 2014
Columnstore indexes in sql server 2014Antonios Chatzipavlis
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyAntonios Chatzipavlis
 
Practical examples of using extended events
Practical examples of using extended eventsPractical examples of using extended events
Practical examples of using extended eventsDean Richards
 

Similaire à SQL Server 2008 For Developers (20)

Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptx
 
Exciting Features for SQL Devs in SQL 2012
Exciting Features for SQL Devs in SQL 2012Exciting Features for SQL Devs in SQL 2012
Exciting Features for SQL Devs in SQL 2012
 
Ssn0020 ssis 2012 for beginners
Ssn0020   ssis 2012 for beginnersSsn0020   ssis 2012 for beginners
Ssn0020 ssis 2012 for beginners
 
Bringing DevOps to the Database
Bringing DevOps to the DatabaseBringing DevOps to the Database
Bringing DevOps to the Database
 
Sap bods Training in Hyderabad | Sap bods Online Training
Sap bods Training in Hyderabad | Sap bods  Online Training Sap bods Training in Hyderabad | Sap bods  Online Training
Sap bods Training in Hyderabad | Sap bods Online Training
 
Sap bods training in hyderabad
Sap bods training in hyderabadSap bods training in hyderabad
Sap bods training in hyderabad
 
Remote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New FeaturesRemote DBA Experts SQL Server 2008 New Features
Remote DBA Experts SQL Server 2008 New Features
 
Using T-SQL
Using T-SQL Using T-SQL
Using T-SQL
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 
World2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverviewWorld2016_T5_S5_SQLServerFunctionalOverview
World2016_T5_S5_SQLServerFunctionalOverview
 
A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!A Complete BI Solution in About an Hour!
A Complete BI Solution in About an Hour!
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site ReviewECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
ECMDay2015 - Kent Agerlund – Configuration Manager 2012 – A Site Review
 
Columnstore indexes in sql server 2014
Columnstore indexes in sql server 2014Columnstore indexes in sql server 2014
Columnstore indexes in sql server 2014
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Ow
OwOw
Ow
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
Practical examples of using extended events
Practical examples of using extended eventsPractical examples of using extended events
Practical examples of using extended events
 
Database training for developers
Database training for developersDatabase training for developers
Database training for developers
 

Plus de John Sterrett

DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
Getting Started with SQL Server Performance Tuning.pdf
Getting Started with SQL Server Performance Tuning.pdfGetting Started with SQL Server Performance Tuning.pdf
Getting Started with SQL Server Performance Tuning.pdfJohn Sterrett
 
Workload Replay in the Cloud: Secret Weapon for Cloud Migrations
Workload Replay in the Cloud: Secret Weapon for Cloud MigrationsWorkload Replay in the Cloud: Secret Weapon for Cloud Migrations
Workload Replay in the Cloud: Secret Weapon for Cloud MigrationsJohn Sterrett
 
Introduction to High Availability with SQL Server
Introduction to High Availability with SQL ServerIntroduction to High Availability with SQL Server
Introduction to High Availability with SQL ServerJohn Sterrett
 
Introduction to PowerShell for DBA's
Introduction to PowerShell for DBA'sIntroduction to PowerShell for DBA's
Introduction to PowerShell for DBA'sJohn Sterrett
 
SQL Server Performance Root Cause Analysis in 10 Minutes
SQL Server Performance Root Cause Analysis in 10 MinutesSQL Server Performance Root Cause Analysis in 10 Minutes
SQL Server Performance Root Cause Analysis in 10 MinutesJohn Sterrett
 
Table Partitioning: Secret Weapon for Big Data Problems
Table Partitioning: Secret Weapon for Big Data ProblemsTable Partitioning: Secret Weapon for Big Data Problems
Table Partitioning: Secret Weapon for Big Data ProblemsJohn Sterrett
 
Introduction to execution plan analysis
Introduction to execution plan analysisIntroduction to execution plan analysis
Introduction to execution plan analysisJohn Sterrett
 
12 Steps to Workload Tuning
12 Steps to Workload Tuning12 Steps to Workload Tuning
12 Steps to Workload TuningJohn Sterrett
 
Performance Tuning for Pirates!
Performance Tuning for Pirates!Performance Tuning for Pirates!
Performance Tuning for Pirates!John Sterrett
 
Can You Host a SQL Saturday?
Can You Host a SQL Saturday?Can You Host a SQL Saturday?
Can You Host a SQL Saturday?John Sterrett
 
Evaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based ManagementEvaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based ManagementJohn Sterrett
 
Evaluate Daily Checklist with PBM and CMS
Evaluate Daily Checklist with PBM and CMSEvaluate Daily Checklist with PBM and CMS
Evaluate Daily Checklist with PBM and CMSJohn Sterrett
 

Plus de John Sterrett (14)

DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
Getting Started with SQL Server Performance Tuning.pdf
Getting Started with SQL Server Performance Tuning.pdfGetting Started with SQL Server Performance Tuning.pdf
Getting Started with SQL Server Performance Tuning.pdf
 
Workload Replay in the Cloud: Secret Weapon for Cloud Migrations
Workload Replay in the Cloud: Secret Weapon for Cloud MigrationsWorkload Replay in the Cloud: Secret Weapon for Cloud Migrations
Workload Replay in the Cloud: Secret Weapon for Cloud Migrations
 
PowerPivot for DBAs
PowerPivot for DBAsPowerPivot for DBAs
PowerPivot for DBAs
 
Introduction to High Availability with SQL Server
Introduction to High Availability with SQL ServerIntroduction to High Availability with SQL Server
Introduction to High Availability with SQL Server
 
Introduction to PowerShell for DBA's
Introduction to PowerShell for DBA'sIntroduction to PowerShell for DBA's
Introduction to PowerShell for DBA's
 
SQL Server Performance Root Cause Analysis in 10 Minutes
SQL Server Performance Root Cause Analysis in 10 MinutesSQL Server Performance Root Cause Analysis in 10 Minutes
SQL Server Performance Root Cause Analysis in 10 Minutes
 
Table Partitioning: Secret Weapon for Big Data Problems
Table Partitioning: Secret Weapon for Big Data ProblemsTable Partitioning: Secret Weapon for Big Data Problems
Table Partitioning: Secret Weapon for Big Data Problems
 
Introduction to execution plan analysis
Introduction to execution plan analysisIntroduction to execution plan analysis
Introduction to execution plan analysis
 
12 Steps to Workload Tuning
12 Steps to Workload Tuning12 Steps to Workload Tuning
12 Steps to Workload Tuning
 
Performance Tuning for Pirates!
Performance Tuning for Pirates!Performance Tuning for Pirates!
Performance Tuning for Pirates!
 
Can You Host a SQL Saturday?
Can You Host a SQL Saturday?Can You Host a SQL Saturday?
Can You Host a SQL Saturday?
 
Evaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based ManagementEvaluating Daily Checklist Against 1000 Servers using Policy Based Management
Evaluating Daily Checklist Against 1000 Servers using Policy Based Management
 
Evaluate Daily Checklist with PBM and CMS
Evaluate Daily Checklist with PBM and CMSEvaluate Daily Checklist with PBM and CMS
Evaluate Daily Checklist with PBM and CMS
 

Dernier

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Dernier (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

SQL Server 2008 For Developers

  • 1. SQL Server 2008 for Developers http://johnsterrett.com/ John Sterrett, @JohnSterrett
  • 2. About Me! • Working with SQL Server since 2006 • Production DBA for 2 Years • Responsible for 50 • Reside in Wheeling, Production instances with WV (Pittsburgh, PA) 1250 Databases • Syndicated Blogger • .NET Developer for 3 on SQLServerPedia Years • Writer for • Built a few Data Marts MSSQLTIPS.com Session Code • Session Title
  • 3. Topics to Cover….. • Management Studio (SSMS) Enhancements • T-SQL Delighters • Filtered Indexes • New Date and Time Data Types • Table-Valued Parameters • MERGE statement • Policy Based Management • Change Data Capture Session Code • Session Title
  • 4. Management Studio Enhancements • IntelliSense • Debugging • Error List • Object Explorer Details Viewer • Template Explorer • Activity Monitor Session Code • Session Title
  • 5. Transact-SQL Delighters • Declare and Initialize Variables • Compound assignment Operators • Table Value Constructor Support through the VALUES Clause Session Code • Session Title
  • 6. DEMO!!! Demo covering The following topics • IntelliSense • Debugging • Error Lists • Object Explorer Details • Template Explorer • Activity Monitor Session Code • Session Title
  • 7. Filtered Indexes! Have you ever wanted to create an index that filters between a static search criteria? CREATE INDEX idxName ON Schema.Table (Column) WHERE …… Session Code • Session Title
  • 8. Filtered Indexes! • Improved query performance and plan quality if used correctly! • Reduced index maintenance costs • Reduced index storage costs Session Code • Session Title
  • 9. DEMO Filtered Indexes Demo…. Session Code • Session Title
  • 10. New Date & Time Types • SQL Server 2008 extends date/time support • Larger Value Space – Current DATETIME - 1753-9999 Years – Current DATETIME - 0.00333 Second Accuracy – New Date Types - 0001-9999 Years – New Date/Time Types - Precisions to 100 nanoseconds • Variable Precision Saves Space • Separate Date and Time Saves Space • ANSI Compatible Session Code • Session Title
  • 11. Date and Time DATE Data Type • Date Only • 01-01-0001 to 31-12-9999 Gregorian Calendar TIME Data Type • Time Only • Variable Precision - 0 to 7 decimal places for seconds • To 100 nanoseconds Session Code • Session Title
  • 12. DATETIME2 & DATETIMEOFFSET DATETIME2 Data Type • 01-01-0001 to 31-12-9999 Gregorian Calendar • Variable Precision - to 100 nanoseconds DATETIMEOFFSET • 01-01-0001 to 31-12-9999 Gregorian Calendar • Variable Precision - to 100 nanoseconds • Time Zone Offset (From UTCTime) Preserved • Not Time Zone Aware - No Daylight Saving Time Support Session Code • Session Title
  • 13. DATETIMEOFFSET • SWITCHOFFSET (DATETIMEOFFSET, time_zone) • Allows you to change time zones • SqlDbType.DateTimeOffset Session Code • Session Title
  • 14. Demo!! T-SQL Date and Time DATETIMEOFFSET with .NET Session Code • Session Title
  • 15. Table-Value Parameters Have you wished that you could send a table into a stored procedure? Do you wish you could send all parent-child relationship data in one round-trip? Session Code • Session Title
  • 16. Table Types SQL Server has table variables • DECLARE @t TABLE (id int); SQL Server 2008 adds strongly typed table variables • CREATE TYPE mytab AS TABLE (id int); DECLARE @t mytab; Table-Value Parameters must use strongly typed table variables Session Code • Session Title
  • 17. Things to know about TVP ADO.NET 3.5 Supports Table Value Parameters You can populate TVP from the following .NET objects • DataTable • DbDataReader • System.Collections.Generic.IList <SQLDataRecord> Recommended for 1000 or less records Session Code • Session Title
  • 18. TVP with .NET SqlParameter tvpParam = new SqlParameter(); tvpParam.ParameterName = "@TVP"; tvpParam.Value = dtList; //DataTable in this example tvpParam.SqlDbType = SqlDbType.Structured; // This data type allows us to pass a table into DB Objects tvpParam.TypeName = "TVPComponentType"; // Name of strong typed (table type) Session Code • Session Title
  • 19. Demo!! Table-Value Parameters with T-SQL Table-Value Parameters with ASP.NET (C#) Session Code • Session Title
  • 20. MERGE!!! TRUNCATE TABLE db1.dbo.fool INSERT INTO db1.dbo.fool SELECT * FROM db2.dbo.fool Session Code • Session Title
  • 21. Merge Statement Multiple set operations in a single SQL statement Uses multiple sets as input • MERGE target USING source ON ... Operations can be INSERT, UPDATE, DELETE Operations based on • WHEN MATCHED • WHEN [TARGET] NOT MATCHED • WHEN SOURCE NOT MATCHED ANSI SQL 2006 compliant - with extensions Session Code • Session Title
  • 22. More on MERGE Multiple WHEN clauses possible • For MATCHED and SOURCE NOT MATCHED • Only one WHEN clause for TARGET NOT MATCHED MERGE can be used with any table source A MERGE statement causes triggers to be fired once Rows affected includes total rows affected by all clauses Session Code • Session Title
  • 23. MERGE Performance MERGE statement is transactional • No explicit transaction required One Pass Through Tables • At most a full outer join • Matching rows = when matched • Left-outer join rows = when target not matched • Right-outer join rows = when source not matched Session Code • Session Title
  • 24. DEMO!! Demo Merge with T-SQL! Session Code • Session Title
  • 25. Central Management System (CMS) & Policy Based Management Have you ever wanted to run a script against all production databases? Have you ever wanted to enforce naming conventions in SQL Programming? Session Code • Session Title
  • 26. CMS and PBM • Central Management System • Needs only 1 instance of SQL 2008 • Reactive not proactive • great tool for updating objects on multiple servers • Policy Based Management • proactive tool prevents stuff from happening • great tool to enforce compliance on SQL 2008+ servers Session Code • Session Title
  • 27. Policy Based Management • Facets • Conditions • Policies Session Code • Session Title
  • 28. DEMO! Demo monitoring and enforcing naming standards with Policy Based Management Session Code • Session Title
  • 29. Change Data Capture Have you ever wanted to get row deltas on a table without using triggers on the source table? Session Code • Session Title
  • 30. Enable Change Data Capture • Must have Enterprise Edition • Uses transaction log to pull deltas • Enable on database (req sysadmin) • sys.sp_cdc_enable_db_change_data_capture • creates cdc schema • creates cdc user • creates system tables with cdc schema • Enable on table(s) (req db_owner) • sys.sp_cdc_enable_table • creates sql agent jobs • creates table cdc.schema_tablename_CT Session Code • Session Title
  • 31. Change Data Capture data • Changes stored in cdc.schema_tablename_CT • _$operation column specifies change type • 1 = DELETE • 2 = INSERT • 3 = BEFORE UPDATE • 4 = AFTER UPDATE Session Code • Session Title
  • 32. Querying Change data • cdc.fn_cdc_get_all_changes<capture_instance> • gets all changes during specific range • cdc.fn_cdc_get_net_changes<capture_instance> • returns final (net change) for each row in the specific range Session Code • Session Title
  • 33. SSIS with CDC Session Code • Session Title
  • 34. DEMO! Enable and use Change Data Capture Session Code • Session Title
  • 35. How do you get started? Using the Transact-SQL Debugger SQL 2008 JumpStart MSDN – SQL 2008 Virtual Labs Developer Fundamentals Part 1: Uncovering T-SQL on SQL Server 2008 Session Code • Session Title
  • 36. Thank you for attending this session and the 2010 PASS Summit in Seattle

Notes de l'éditeur

  1. http://technet.microsoft.com/en-us/library/cc280372.aspx
  2. Datetime2 is the ansi compatible version as it has the correct accuracy and rangeDatetimeoffset stores datetime and an offset. It doesn’t store the actual timezone or anything about daylight saving time.The client session includes an app that stores the timezone.Both are variable precision, save space and increase performance by specifying the correct size.