SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Enterprise Data Validation Hampton Roads .NET User Group November2009 W. Kevin Hazzard, C# MVP, MCSD.NET
Problem Statement Getting your data validation synchronized across all the tiers of an application isn't easy Storing metadata about validations that need to occur as pure data can be less than ideal
One Possible Solution Extend SQL Server to support Regular Expression matching Store validation metadata as a set of extended properties in SQL Server Expose your validation metadata as a service
What are extended properties? SQL_VARIANT metadata that can be applied to many SQL database objects Examples Add a DATETIME stamp or integer serial number to a table definition to mark its schema version Add Spanish and English description properties to a view as documentation for consumers Add a tag to a public key certificate to record where the private key is escrowed and by whom Add a regular expression to a table's column definition to record the pattern (input mask) that should be used to validate the data
SQL Objects That May Be Extended ,[object Object]
Asymmetric Key
Assembly
Certificate
Column*
Contract
Database
Default
Event Notification
Filegroup
File name
Schema
Service

Weitere ähnliche Inhalte

Was ist angesagt?

retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
Arun Nair
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
Achmad Solichin
 

Was ist angesagt? (20)

Introductontoxaml
IntroductontoxamlIntroductontoxaml
Introductontoxaml
 
Meet the CBO in Version 11g
Meet the CBO in Version 11gMeet the CBO in Version 11g
Meet the CBO in Version 11g
 
Lab5 sub query
Lab5   sub queryLab5   sub query
Lab5 sub query
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SAS
 
SQL Views
SQL ViewsSQL Views
SQL Views
 
Nested Queries Lecture
Nested Queries LectureNested Queries Lecture
Nested Queries Lecture
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
SQL
SQLSQL
SQL
 
Ejb5
Ejb5Ejb5
Ejb5
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
 
Les08
Les08Les08
Les08
 
Oracle query optimizer
Oracle query optimizerOracle query optimizer
Oracle query optimizer
 
retrieving data using SQL statements
retrieving data using SQL statementsretrieving data using SQL statements
retrieving data using SQL statements
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle Sql
 
Web Developer make the most out of your Database !
Web Developer make the most out of your Database !Web Developer make the most out of your Database !
Web Developer make the most out of your Database !
 
Les01
Les01Les01
Les01
 
Unbreakable Domain Models - DPC13
Unbreakable Domain Models - DPC13Unbreakable Domain Models - DPC13
Unbreakable Domain Models - DPC13
 
How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8
 
Trigger
TriggerTrigger
Trigger
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
 

Ähnlich wie Enterprise Data Validation

SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIR
Peter Elst
 
Les08-Oracle
Les08-OracleLes08-Oracle
Les08-Oracle
suman1248
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
Reka
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
Jevgeni Kabanov
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
phelios
 

Ähnlich wie Enterprise Data Validation (20)

SQLite in Adobe AIR
SQLite in Adobe AIRSQLite in Adobe AIR
SQLite in Adobe AIR
 
Les08-Oracle
Les08-OracleLes08-Oracle
Les08-Oracle
 
Dat402
Dat402Dat402
Dat402
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 
Sql Objects And PL/SQL
Sql Objects And PL/SQLSql Objects And PL/SQL
Sql Objects And PL/SQL
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Framework
FrameworkFramework
Framework
 
JPA 2.0
JPA 2.0JPA 2.0
JPA 2.0
 
Chapter09
Chapter09Chapter09
Chapter09
 
Test driven development_for_php
Test driven development_for_phpTest driven development_for_php
Test driven development_for_php
 
Building and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning CBuilding and Distributing PostgreSQL Extensions Without Learning C
Building and Distributing PostgreSQL Extensions Without Learning C
 
Sql Summit Clr, Service Broker And Xml
Sql Summit   Clr, Service Broker And XmlSql Summit   Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
 
Function Procedure Trigger Partition.pdf
Function Procedure Trigger Partition.pdfFunction Procedure Trigger Partition.pdf
Function Procedure Trigger Partition.pdf
 
P H P Part I I, By Kian
P H P  Part  I I,  By  KianP H P  Part  I I,  By  Kian
P H P Part I I, By Kian
 
SQl
SQlSQl
SQl
 
Slides11
Slides11Slides11
Slides11
 
displaytag
displaytagdisplaytag
displaytag
 
Pxb For Yapc2008
Pxb For Yapc2008Pxb For Yapc2008
Pxb For Yapc2008
 

Mehr von Kevin Hazzard

What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#
Kevin Hazzard
 
Better contracts better code - august 2010
Better contracts   better code - august 2010Better contracts   better code - august 2010
Better contracts better code - august 2010
Kevin Hazzard
 

Mehr von Kevin Hazzard (7)

C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
 
What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#What the math geeks don't want you to know about F#
What the math geeks don't want you to know about F#
 
Better contracts better code - august 2010
Better contracts   better code - august 2010Better contracts   better code - august 2010
Better contracts better code - august 2010
 
Introduction to SQL Azure
Introduction to SQL AzureIntroduction to SQL Azure
Introduction to SQL Azure
 
Dynamic Language Performance
Dynamic Language PerformanceDynamic Language Performance
Dynamic Language Performance
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

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)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 

Enterprise Data Validation

  • 1. Enterprise Data Validation Hampton Roads .NET User Group November2009 W. Kevin Hazzard, C# MVP, MCSD.NET
  • 2. Problem Statement Getting your data validation synchronized across all the tiers of an application isn't easy Storing metadata about validations that need to occur as pure data can be less than ideal
  • 3. One Possible Solution Extend SQL Server to support Regular Expression matching Store validation metadata as a set of extended properties in SQL Server Expose your validation metadata as a service
  • 4. What are extended properties? SQL_VARIANT metadata that can be applied to many SQL database objects Examples Add a DATETIME stamp or integer serial number to a table definition to mark its schema version Add Spanish and English description properties to a view as documentation for consumers Add a tag to a public key certificate to record where the private key is escrowed and by whom Add a regular expression to a table's column definition to record the pattern (input mask) that should be used to validate the data
  • 5.
  • 20. Table
  • 22. Type
  • 23. User
  • 24. View
  • 32. Queue
  • 34. Route
  • 35. Rule* Columns aren't objects in SQL server but they can be extended
  • 36. Extended Property Functions sp_addextendedproperty sp_updateextendedproperty sp_dropextendedproperty fn_listextendedproperty sys.extended_properties
  • 37. Adding Extended Properties sp_addextendedproperty [ @name = ] { 'property_name' } [ , [ @value = ] { 'value' } [ , [ @level0type = ] { 'level0_object_type' } , [ @level0name = ] { 'level0_object_name' } [ , [ @level1type = ] { 'level1_object_type' } , [ @level1name = ] { 'level1_object_name' } [ , [ @level2type = ] { 'level2_object_type' } , [ @level2name = ] { 'level2_object_name' }]]] ] Returns 0 (false) for failure or 1 (true) for success.
  • 38. Add Extended Property to Column EXEC sp_addextendedproperty@name = N'Name of the extended property',@value = N'Value of the extended property',@level0type = N'Schema', @level0name = SCHMNAME,@level1type = N'Table', @level1name = TBLNAME,@level2type = N'Column', @level2name = COLNAME;
  • 39. Listing Extended Properties fn_listextendedproperty ( { default | 'property_name' | NULL } , { default | 'level0_object_type' | NULL } , { default | 'level0_object_name' | NULL } , { default | 'level1_object_type' | NULL } , { default | 'level1_object_name' | NULL } , { default | 'level2_object_type' | NULL } , { default | 'level2_object_name' | NULL } ) Table-valued function returning: objtype, objname and name as sysname value as sql_variant
  • 40. Listing Extended Properties for a Column SELECT objtype, objname, name, value FROM fn_listextendedproperty( NULL, 'schema', 'SCHMNAME', 'table', 'TBLNAME', 'column', default );
  • 41. Querying sys.properties SELECT ep.major_id, ep.minor_id, t.name AS [Table Name], ep.name AS [ExtProp Name], c.name AS [Column Name], ep.value AS [Extended Property] FROM sys.extended_properties AS ep INNER JOIN sys.tables AS t ON ep.major_id = t.object_id INNER JOIN sys.columns AS c ON ep.major_id = c.object_id AND ep.minor_id = c.column_id WHERE ep.class = 1;
  • 42. Demonstration 1 Experimenting with SQL Extended Properties
  • 43. Using Regular Expression in SQL Server to Validate Data We can extend SQL Server by adding functions written in C# or Visual Basic The .NET Framework has a great Regular Expressions implementation – let's use it! public class UserDefinedFunctions { [SqlFunction(IsDeterministic = true)] public static SqlBooleanRegexIsMatch( SqlString pattern, SqlString input) { varrex = new Regex(pattern.Value); return rex.IsMatch(input.Value); } };
  • 44. Don't Forget This You must enable the SQL CLR It's disabled by default sp_configure'clr enabled', 1RECONFIGURE WITH OVERRIDEGO
  • 45. Demonsration 2 Adding a SQL CLR User-Defined Function for Regular Expression Matching
  • 46. Pulling It All Together What if we could save regular expressions as metadata to validate our OLTP data? What if we had conventions for storing and accessing that metadata? We could write helper functions that took full advantage of those conventions We could write other kinds of assertions and constraints in the database that depended on them, too We could expose that metadata as a service and use it in multiple application tiers
  • 47. Demonstrations 3 & 4 Baking Validation Into SQL Using Metadata and Constraints Implementing a WCF Service to Expose Validation Metadata
  • 48. For More Information Kevin Hazzard's Bloghttp://tinyurl.com/KevinHazzard Kevin Hazzard'sSlideshare Sitehttp://slideshare.net/wkhazzard Kevin Hazzard'sSpeakerRate Sitehttp://speakerrate.com/wkhazzard Phil Factor's RegEx Functions for SQLCLRhttp://tinyurl.com/dmsmm2