SlideShare a Scribd company logo
1 of 12
Kevin Howell
kevhowell@outlook.com
July 2015
Topics
 What?
 Why?
 How?
What
 SQL Server, User-Defined Type
 Technique to pass multiple rows of data to procedure
 Introduced in SQL 2008
 Based on strongly-typed table structures in SQL Server
Why
 To STOP iterative calls to the database
Why
 To REPLACE XML packaging & parsing
Package
Into XML
Parse
XML
Package
Into XML
Parse
XML
Why
 To EXPEDITE debugging of code AND procedures
<Employees>
<EmployeeID>120</EmployeeID>
<FirstName>Joe</FirstName>
<LastName>Smith</LastName>
</Employees>
<Employees>
<EmployeeID>124</EmployeeID>
<FirstName>Sally</FirstName>
<LastName>Jones</LastName>
</Employees>
XML
TVP
EmployeeID FirstName LastName
120 Joe Smith
124 Sally Jones
Why
 To SPEED up procedures
TIME
# RECORDS
Demo
How (to Create)
 Database
 Create User-Defined Table Type
 Grant Permissions on the Table Type
 Create/Modify Procedure to use Table Type
 Code
 Create a DataTable definition that represents the
Table Type
 Fill the DataTable from existing collection
 Pass the DataTable into the Stored Procedure
How (to Change)
 Database Schema Changes
 Open Procedure(s) in SSMS
 Change the ALTER to CREATE
 Drop the Procedure
 Drop and create the Table Type (with changes)
 Re-create the procedure (with changes)
Resources
 MSDN – Table-Valued Parameters
 USLI - TVP Basic Instructions
 The Trouble with Type Tables
Questions?

More Related Content

Viewers also liked

Eric Nelson's Portfolio
Eric Nelson's PortfolioEric Nelson's Portfolio
Eric Nelson's PortfolioEric Nelson
 
Metodologie admitere-doctorat-sept.-2014
Metodologie admitere-doctorat-sept.-2014Metodologie admitere-doctorat-sept.-2014
Metodologie admitere-doctorat-sept.-2014Radu Adriana Elena
 
Asian J Anim Vet Adv.
Asian J Anim Vet Adv.Asian J Anim Vet Adv.
Asian J Anim Vet Adv.1611974
 
Buku petunjuk-epupns-admin
Buku petunjuk-epupns-adminBuku petunjuk-epupns-admin
Buku petunjuk-epupns-adminM Sabda Abdillah
 
Ayan Talukder Portfolio (SMDC) - LinkedIn
Ayan Talukder Portfolio (SMDC) - LinkedInAyan Talukder Portfolio (SMDC) - LinkedIn
Ayan Talukder Portfolio (SMDC) - LinkedInAyan Talukder
 
บทที่ 4 การจัดวางเนื้อหา
บทที่ 4 การจัดวางเนื้อหาบทที่ 4 การจัดวางเนื้อหา
บทที่ 4 การจัดวางเนื้อหาNattipong Siangyen
 
Картридж на замену
Картридж на заменуКартридж на замену
Картридж на заменуYOUR∆ YOUKΞY
 
RateMate Presentation
RateMate PresentationRateMate Presentation
RateMate PresentationBassel Damra
 
"Elements of Byron" Steel and aluminium imitating sand
"Elements of Byron"  Steel and aluminium imitating sand"Elements of Byron"  Steel and aluminium imitating sand
"Elements of Byron" Steel and aluminium imitating sandClive Harmsworth
 

Viewers also liked (13)

Eric Nelson's Portfolio
Eric Nelson's PortfolioEric Nelson's Portfolio
Eric Nelson's Portfolio
 
Tenses with Grammar rules
Tenses with Grammar rulesTenses with Grammar rules
Tenses with Grammar rules
 
Metodologie admitere-doctorat-sept.-2014
Metodologie admitere-doctorat-sept.-2014Metodologie admitere-doctorat-sept.-2014
Metodologie admitere-doctorat-sept.-2014
 
Asian J Anim Vet Adv.
Asian J Anim Vet Adv.Asian J Anim Vet Adv.
Asian J Anim Vet Adv.
 
Buku petunjuk-epupns-admin
Buku petunjuk-epupns-adminBuku petunjuk-epupns-admin
Buku petunjuk-epupns-admin
 
Ayan Talukder Portfolio (SMDC) - LinkedIn
Ayan Talukder Portfolio (SMDC) - LinkedInAyan Talukder Portfolio (SMDC) - LinkedIn
Ayan Talukder Portfolio (SMDC) - LinkedIn
 
2015眾志成城閃電秀_Ad partner
2015眾志成城閃電秀_Ad partner2015眾志成城閃電秀_Ad partner
2015眾志成城閃電秀_Ad partner
 
บทที่ 4 การจัดวางเนื้อหา
บทที่ 4 การจัดวางเนื้อหาบทที่ 4 การจัดวางเนื้อหา
บทที่ 4 การจัดวางเนื้อหา
 
Satish Resume
Satish ResumeSatish Resume
Satish Resume
 
Картридж на замену
Картридж на заменуКартридж на замену
Картридж на замену
 
RateMate Presentation
RateMate PresentationRateMate Presentation
RateMate Presentation
 
"Elements of Byron" Steel and aluminium imitating sand
"Elements of Byron"  Steel and aluminium imitating sand"Elements of Byron"  Steel and aluminium imitating sand
"Elements of Byron" Steel and aluminium imitating sand
 
NEW_FOR_C
NEW_FOR_CNEW_FOR_C
NEW_FOR_C
 

Similar to TableValuedParameters

Higher Productivity With Ase
Higher Productivity With AseHigher Productivity With Ase
Higher Productivity With Asesparkwan
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...djkucera
 
Successful DB migrations with Liquibase
 Successful DB migrations with Liquibase Successful DB migrations with Liquibase
Successful DB migrations with LiquibaseIllia Seleznov
 
Web Cloud Computing SQL Server - Ferrara University
Web Cloud Computing SQL Server  -  Ferrara UniversityWeb Cloud Computing SQL Server  -  Ferrara University
Web Cloud Computing SQL Server - Ferrara Universityantimo musone
 
SQL Server 2008 For Developers
SQL Server 2008 For DevelopersSQL Server 2008 For Developers
SQL Server 2008 For DevelopersJohn Sterrett
 
Liquibase for java developers
Liquibase for java developersLiquibase for java developers
Liquibase for java developersIllia Seleznov
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Datastage Online Training @ Adithya Elearning
Datastage Online Training @ Adithya ElearningDatastage Online Training @ Adithya Elearning
Datastage Online Training @ Adithya Elearningshanmukha rao dondapati
 
SQL Server 2000 Research Series - Essential Knowledge
SQL Server 2000 Research Series - Essential KnowledgeSQL Server 2000 Research Series - Essential Knowledge
SQL Server 2000 Research Series - Essential KnowledgeJerry Yang
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLJerry Yang
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012Eduardo Castro
 
Rock Solid SQL Server Management
Rock Solid SQL Server ManagementRock Solid SQL Server Management
Rock Solid SQL Server ManagementTony Bain
 
Satyajeet_Parida-SQL_SERVER_DBA
Satyajeet_Parida-SQL_SERVER_DBASatyajeet_Parida-SQL_SERVER_DBA
Satyajeet_Parida-SQL_SERVER_DBASatyajeet Parida
 
How to Troubleshoot & Optimize Database Query Performance for Your Application
How to Troubleshoot  & Optimize Database Query Performance for Your ApplicationHow to Troubleshoot  & Optimize Database Query Performance for Your Application
How to Troubleshoot & Optimize Database Query Performance for Your ApplicationDynatrace
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015Alex Zaballa
 

Similar to TableValuedParameters (20)

Higher Productivity With Ase
Higher Productivity With AseHigher Productivity With Ase
Higher Productivity With Ase
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
 
Successful DB migrations with Liquibase
 Successful DB migrations with Liquibase Successful DB migrations with Liquibase
Successful DB migrations with Liquibase
 
Web Cloud Computing SQL Server - Ferrara University
Web Cloud Computing SQL Server  -  Ferrara UniversityWeb Cloud Computing SQL Server  -  Ferrara University
Web Cloud Computing SQL Server - Ferrara University
 
SQL Server 2008 For Developers
SQL Server 2008 For DevelopersSQL Server 2008 For Developers
SQL Server 2008 For Developers
 
Liquibase for java developers
Liquibase for java developersLiquibase for java developers
Liquibase for java developers
 
Apache TAJO
Apache TAJOApache TAJO
Apache TAJO
 
Oracle XML DB - What's in it for me?
Oracle XML DB - What's in it for me?Oracle XML DB - What's in it for me?
Oracle XML DB - What's in it for me?
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Datastage Online Training @ Adithya Elearning
Datastage Online Training @ Adithya ElearningDatastage Online Training @ Adithya Elearning
Datastage Online Training @ Adithya Elearning
 
SQL Server 2000 Research Series - Essential Knowledge
SQL Server 2000 Research Series - Essential KnowledgeSQL Server 2000 Research Series - Essential Knowledge
SQL Server 2000 Research Series - Essential Knowledge
 
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQLSQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
 
Module02
Module02Module02
Module02
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012
 
Rock Solid SQL Server Management
Rock Solid SQL Server ManagementRock Solid SQL Server Management
Rock Solid SQL Server Management
 
Stretch db sql server 2016 (sn0028)
Stretch db   sql server 2016 (sn0028)Stretch db   sql server 2016 (sn0028)
Stretch db sql server 2016 (sn0028)
 
Satyajeet_Parida-SQL_SERVER_DBA
Satyajeet_Parida-SQL_SERVER_DBASatyajeet_Parida-SQL_SERVER_DBA
Satyajeet_Parida-SQL_SERVER_DBA
 
How to Troubleshoot & Optimize Database Query Performance for Your Application
How to Troubleshoot  & Optimize Database Query Performance for Your ApplicationHow to Troubleshoot  & Optimize Database Query Performance for Your Application
How to Troubleshoot & Optimize Database Query Performance for Your Application
 
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015Oracle Database 12c  New Features for Developers and DBAs - OTN TOUR LA 2015
Oracle Database 12c New Features for Developers and DBAs - OTN TOUR LA 2015
 

TableValuedParameters

  • 3. What  SQL Server, User-Defined Type  Technique to pass multiple rows of data to procedure  Introduced in SQL 2008  Based on strongly-typed table structures in SQL Server
  • 4. Why  To STOP iterative calls to the database
  • 5. Why  To REPLACE XML packaging & parsing Package Into XML Parse XML Package Into XML Parse XML
  • 6. Why  To EXPEDITE debugging of code AND procedures <Employees> <EmployeeID>120</EmployeeID> <FirstName>Joe</FirstName> <LastName>Smith</LastName> </Employees> <Employees> <EmployeeID>124</EmployeeID> <FirstName>Sally</FirstName> <LastName>Jones</LastName> </Employees> XML TVP EmployeeID FirstName LastName 120 Joe Smith 124 Sally Jones
  • 7. Why  To SPEED up procedures TIME # RECORDS
  • 9. How (to Create)  Database  Create User-Defined Table Type  Grant Permissions on the Table Type  Create/Modify Procedure to use Table Type  Code  Create a DataTable definition that represents the Table Type  Fill the DataTable from existing collection  Pass the DataTable into the Stored Procedure
  • 10. How (to Change)  Database Schema Changes  Open Procedure(s) in SSMS  Change the ALTER to CREATE  Drop the Procedure  Drop and create the Table Type (with changes)  Re-create the procedure (with changes)
  • 11. Resources  MSDN – Table-Valued Parameters  USLI - TVP Basic Instructions  The Trouble with Type Tables