Submit Search
Upload
Sql Server - Apresentação
•
0 likes
•
303 views
Professora Maria Lúcia Etec
Follow
Aula exemplo para atividade e-learning
Read less
Read more
Technology
Report
Share
Report
Share
1 of 14
Download now
Download to read offline
Recommended
Ddl
Ddl
Welly Dian Astika
Ice mini guide
Ice mini guide
Ady Liu
Shrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_you
SHRUG GIS
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
Jafka guide
Jafka guide
Ady Liu
Unit test candidate solutions
Unit test candidate solutions
benewu
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
SegFaultConf
Apache Cassandra, part 3 – machinery, work with Cassandra
Apache Cassandra, part 3 – machinery, work with Cassandra
Andrey Lomakin
Recommended
Ddl
Ddl
Welly Dian Astika
Ice mini guide
Ice mini guide
Ady Liu
Shrug2017 arcpy data_and_you
Shrug2017 arcpy data_and_you
SHRUG GIS
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
Jafka guide
Jafka guide
Ady Liu
Unit test candidate solutions
Unit test candidate solutions
benewu
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
Andrzej Ludwikowski - Event Sourcing - co może pójść nie tak?
SegFaultConf
Apache Cassandra, part 3 – machinery, work with Cassandra
Apache Cassandra, part 3 – machinery, work with Cassandra
Andrey Lomakin
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
Murat Çakal
Cassandra NoSQL
Cassandra NoSQL
Murat Çakal
Ad java prac sol set
Ad java prac sol set
Iram Ramrajkar
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
Return on Intelligence
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
GOG.com dev team
Devtools cheatsheet
Devtools cheatsheet
Dr. Volkan OBAN
Scala4sling
Scala4sling
day
Dependency Injection
Dependency Injection
Alena Holligan
Kamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
kamaelian
Above the clouds: introducing Akka
Above the clouds: introducing Akka
nartamonov
Sqlapi0.1
Sqlapi0.1
jitendral
Lambda Jam 2015: Event Processing in Clojure
Lambda Jam 2015: Event Processing in Clojure
Andy Marks
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Deependra Ariyadewa
Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2
Knoldus Inc.
Paris Cassandra Meetup - Cassandra for Developers
Paris Cassandra Meetup - Cassandra for Developers
Michaël Figuière
Rstudio ide-cheatsheet
Rstudio ide-cheatsheet
Dr. Volkan OBAN
Dynamic websites lec3
Dynamic websites lec3
Belal Arfa
341 Rac
341 Rac
Emanuel Mateus
NYC* Tech Day - New Cassandra Drivers in Depth
NYC* Tech Day - New Cassandra Drivers in Depth
Michaël Figuière
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
mlraviol
Task 2 analysis of nme music magazine
Task 2 analysis of nme music magazine
asmediab15
Teste 1º. 10ºe. 29 outubro 2010
Teste 1º. 10ºe. 29 outubro 2010
Cristina Mariano
More Related Content
What's hot
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
Murat Çakal
Cassandra NoSQL
Cassandra NoSQL
Murat Çakal
Ad java prac sol set
Ad java prac sol set
Iram Ramrajkar
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
Return on Intelligence
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
GOG.com dev team
Devtools cheatsheet
Devtools cheatsheet
Dr. Volkan OBAN
Scala4sling
Scala4sling
day
Dependency Injection
Dependency Injection
Alena Holligan
Kamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
kamaelian
Above the clouds: introducing Akka
Above the clouds: introducing Akka
nartamonov
Sqlapi0.1
Sqlapi0.1
jitendral
Lambda Jam 2015: Event Processing in Clojure
Lambda Jam 2015: Event Processing in Clojure
Andy Marks
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Deependra Ariyadewa
Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2
Knoldus Inc.
Paris Cassandra Meetup - Cassandra for Developers
Paris Cassandra Meetup - Cassandra for Developers
Michaël Figuière
Rstudio ide-cheatsheet
Rstudio ide-cheatsheet
Dr. Volkan OBAN
Dynamic websites lec3
Dynamic websites lec3
Belal Arfa
341 Rac
341 Rac
Emanuel Mateus
NYC* Tech Day - New Cassandra Drivers in Depth
NYC* Tech Day - New Cassandra Drivers in Depth
Michaël Figuière
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
mlraviol
What's hot
(20)
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
Cassandra NoSQL
Cassandra NoSQL
Ad java prac sol set
Ad java prac sol set
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
In-depth caching in Varnish - GOG Varnish Meetup, march 2019
Devtools cheatsheet
Devtools cheatsheet
Scala4sling
Scala4sling
Dependency Injection
Dependency Injection
Kamaelia Protocol Walkthrough
Kamaelia Protocol Walkthrough
Above the clouds: introducing Akka
Above the clouds: introducing Akka
Sqlapi0.1
Sqlapi0.1
Lambda Jam 2015: Event Processing in Clojure
Lambda Jam 2015: Event Processing in Clojure
Store and Process Big Data with Hadoop and Cassandra
Store and Process Big Data with Hadoop and Cassandra
Introduction to Apache Kafka- Part 2
Introduction to Apache Kafka- Part 2
Paris Cassandra Meetup - Cassandra for Developers
Paris Cassandra Meetup - Cassandra for Developers
Rstudio ide-cheatsheet
Rstudio ide-cheatsheet
Dynamic websites lec3
Dynamic websites lec3
341 Rac
341 Rac
NYC* Tech Day - New Cassandra Drivers in Depth
NYC* Tech Day - New Cassandra Drivers in Depth
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
Viewers also liked
Task 2 analysis of nme music magazine
Task 2 analysis of nme music magazine
asmediab15
Teste 1º. 10ºe. 29 outubro 2010
Teste 1º. 10ºe. 29 outubro 2010
Cristina Mariano
Trt civil 02 (1)
Trt civil 02 (1)
João Gilberto Costa Lima
Trt português 02
Trt português 02
João Gilberto Costa Lima
Trt previdenciário (1)
Trt previdenciário (1)
João Gilberto Costa Lima
الشهادات٣
الشهادات٣
Saad A Jalalah
YO, MI CULTURA, MI REGIÓN
YO, MI CULTURA, MI REGIÓN
Angel Garcia
Leccion 5 tablas numericas con ceros fep rene
Leccion 5 tablas numericas con ceros fep rene
Martha Martinez
Trabajo sobre edificios en word
Trabajo sobre edificios en word
Andres0694
Rúbrica
Rúbrica
Angelo Robayo
El derecho de autor
El derecho de autor
joanna_torres_225
Comparatives nice two
Comparatives nice two
sawsen abid
Viewers also liked
(12)
Task 2 analysis of nme music magazine
Task 2 analysis of nme music magazine
Teste 1º. 10ºe. 29 outubro 2010
Teste 1º. 10ºe. 29 outubro 2010
Trt civil 02 (1)
Trt civil 02 (1)
Trt português 02
Trt português 02
Trt previdenciário (1)
Trt previdenciário (1)
الشهادات٣
الشهادات٣
YO, MI CULTURA, MI REGIÓN
YO, MI CULTURA, MI REGIÓN
Leccion 5 tablas numericas con ceros fep rene
Leccion 5 tablas numericas con ceros fep rene
Trabajo sobre edificios en word
Trabajo sobre edificios en word
Rúbrica
Rúbrica
El derecho de autor
El derecho de autor
Comparatives nice two
Comparatives nice two
Similar to Sql Server - Apresentação
Sql Summit Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
David Truxall
SQL Server 2005 CLR Integration
SQL Server 2005 CLR Integration
webhostingguy
Day2
Day2
madamewoolf
SQLCLR Tips & Trics
SQLCLR Tips & Trics
Daniel Joskovski
Introduction to Threading in .Net
Introduction to Threading in .Net
webhostingguy
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
Jürgen Ambrosi
SQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
webhostingguy
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
webhostingguy
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
Cisco Canada
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
Luca Lusso
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access from Programming Languages
S.Shayan Daneshvar
SQL Server - CLR integration
SQL Server - CLR integration
Peter Gfader
SQL Server Security - Attack
SQL Server Security - Attack
webhostingguy
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
Darren Sim
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
Jerry Yang
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"
Thomas Bailet
SQL Server SQL Server
SQL Server SQL Server
webhostingguy
SQL Server SQL Server
SQL Server SQL Server
webhostingguy
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
lennartkats
LINQ-Introduction.ppt
LINQ-Introduction.ppt
ssusera8c91a
Similar to Sql Server - Apresentação
(20)
Sql Summit Clr, Service Broker And Xml
Sql Summit Clr, Service Broker And Xml
SQL Server 2005 CLR Integration
SQL Server 2005 CLR Integration
Day2
Day2
SQLCLR Tips & Trics
SQLCLR Tips & Trics
Introduction to Threading in .Net
Introduction to Threading in .Net
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
2° Ciclo Microsoft CRUI 3° Sessione: l'evoluzione delle piattaforme tecnologi...
SQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access from Programming Languages
SQL Server - CLR integration
SQL Server - CLR integration
SQL Server Security - Attack
SQL Server Security - Attack
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
SQL Server 2000 Research Series - Transact SQL
SQL Server 2000 Research Series - Transact SQL
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"
SQL Server SQL Server
SQL Server SQL Server
SQL Server SQL Server
SQL Server SQL Server
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)
LINQ-Introduction.ppt
LINQ-Introduction.ppt
Recently uploaded
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Malak Abu Hammad
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Scott Keck-Warren
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Pooja Nehwal
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
shyamraj55
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Pixlogix Infotech
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
Recently uploaded
(20)
Slack Application Development 101 Slides
Slack Application Development 101 Slides
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Sql Server - Apresentação
1.
SQL Server™ .NET Programmability José
A. Blakeley Architect SQL Server Background l Transact SQL (T -SQL) Ø Ø SQL Server’s database programming language Includes: § § l SQL DDL, SQL DML Variables, assignment, iteration, procedures, functions .NET Platform Ø .NET runtime (Common Language Runtime) § § § Ø Ø Verifiable Intermediate Language Managed memory – garbage collection Multiple languages (e.g, C#, C++, Cobol) (e.g , Frameworks library (e.g., GUI, Files, XML) Assemblies – New Dynamic Link Libraries § § Contain code + metadata (class definitions, assembly dependencies) Unit of code deployment, security, versioning PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 1
2.
Outline l l Motivation Basic Infrastructure Ø Ø Ø l SQL features Ø Ø Ø l Hosting
overview Data access inside process: ADO.NET SQL types Server assemblies Functions, procedures, triggers Types and aggregates Summary Motivation l Broaden the set of languages for running datadata -intensive business logic in server Ø Ø Ø Ø Ø l Packaged as .NET assemblies Ø l Verifiable, secure Deployed to SQL Server as Ø l IT Developers and ISVs Multiple languages: Visual Basic ®, C#, C++, J#, … Same mid - and server -tier data access model midserverSame tools: IDE, project model, debugging, … TransactTransact-SQL still supported Functions, procedures, triggers, types Basis for SQL Server Extensibility PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 2
3.
Development Steps VB, C#,
C++ VS Project Build Runtime hosted inside SQL Server SQL Queries: select sum(tax(sal,state) sum(tax(sal,state) ) from Emp where county = ‘King’ Assembly: “TaxLib.dll” TaxLib.dll” SQL Data Definition: create assembly … create function … create procedure … create trigger … create type … SQL Server Basic Infrastructure l Hosting common language runtime inside SQL Server Ø Ø Ø l Data access in process Ø Ø l 4Ss: Safety, security, scalability, speed Run verified, type-safe code inside typeprocess Multiple languages Based on ADO.NET Same data access programming model as middle -tier middle- SQLTypes Ø SQL type semantics in managed code PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 3
4.
Hosting .NET Runtime l Safety Ø Prevent
user code from corrupting the server process § Ø Use runtime code permissions to control user code when calling § l Verifiable code Unmanaged APIs, user interface, threads, synchronization Security Ø Ø Ø Authorized access to SQL Server data from user code via SQL Server authorization model Authorized access to system resources from user code via runtime code permissions Administrators control permissions given to assemblies Three Code Permission Sets l SAFE Ø Execute & data access permission Ø No access to resources outside SQL Server No unmanaged calls Must be verifiable Ø Ø l EXTERNAL_ACCESS Ø Ø Ø Ø l SAFESQL + access to external resources (Net, File permissions) Requires EXTERNAL ACCESS permission to create SQL Server will impersonate the caller Must be verifiable UNRESTRICTED Ø Ø No controls: Can call unmanged code, can be un-verifiable unOnly Administrators can create PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 4
5.
Hosting .NET Runtime l Scalability As
many concurrent users as, as fast as TransactTransact-SQL Ø § Integrated SQL Server and runtime threads § Collaboration between SQL Server and GC SQL Server becomes OS to the .NET runtime § l Speed Efficient data access in process Compiled user code, not interpreted as TransactTransact-SQL Fast transitions in/out of runtime Ø Ø Ø Speed: Functions .NET function vs. Transact-SQL inline 600 .NET function vs. Transact-SQL function 400 200 1000000 0 1 3 5 7 9 Query time (ms) Query time (ms) 800 100000 10000 11 1 3 15 17 19 21 1000 Integer ops per func call 100 .NET func 23 25 27 29 10 TSQL inline 1 100 1000 10000 Integer ops per call .NET functions approximating speed of TransactTransact.NET func TSQL func SQL inline expressions .NET framework functions much faster than TransactTransact-SQL functions for complex expressions PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 5
6.
Outline l l Motivation Basic Infrastructure Ø Ø Ø l SQL features Ø Ø Ø l Hosting
overview Data access inside process: ADO.NET SQL types Server assemblies Functions, procedures, triggers Types and aggregates Summary ADO .NET Data Access Controls, Designers, etc XSL/T, X -Path, XValidation, etc XmlDataXmlDataDocument XmlReader XmlText- XmlNodeXmlText- XmlNode Reader Reader DataSet Sync SQL Server Managed Managed Managed Provider Provider Provider XmlReader XmlText- XmlNodeXmlText- XmlNode Reader Reader PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 6
7.
Data Access Inside
SQL using System.Data.SqlServer; System.Data.SqlServer; using System.Data.SqlTypes; System.Data.SqlTypes; public class ShippingCosts { public static SqlMoney FreightByShipper( string ship ) { FreightByShipper( SqlCommand cmd = SqlContext.GetCommand( ); SqlContext.GetCommand( cmd.CommandText = "select sum(o.freight) as freight " + "from orders o join shippers s on o.shipvia = s.shipperid " + "where s.companyname = @CompanyName " ; @CompanyName SqlParameter param = cmd.Parameters.Add("@CompanyName", cmd.Parameters.Add("@CompanyName", SqlDbType.NVarChar, SqlDbType.NVarChar, COMPANY_NAME_COL_LENGTH); param.Value = ship; ship; SqlMoney amount = cmd.ExecuteScalar( ); cmd.ExecuteScalar( return amount; } } SQL Types l l l Reduce impedance mismatch between programming language and data Consistent expression evaluation in midmid- and server-tier programming serverSQL Types library Ø Ø Managed classes: System.Data.SqlTypes Provide SQL semantics § § Nullability, threeNullability , three-valued logic Precision and scale in operations PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 7
8.
SQL Types Example Tax
function using SQL types l using System; using System.Data.SQLTypes ; public class myFinances { public static SQLDouble tax( SQLDouble sal ) { if ( sal < 50000.0 ) return sal * 0.15; 0.15; if ( sal >= 50000.0 && sal <= 90000.0 ) return sal * 0.23 else return sal * 0.35; 0.35; } } SQLDouble makes function NULL-aware NULL- Outline l l Motivation Basic Infrastructure Ø Ø Ø l SQL features Ø Ø Ø l Hosting overview Data access inside process: ADO.NET SQL types Server assemblies Functions, procedures, triggers Types and aggregates Summary PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 8
9.
SQL Features Assemblies Functions Procedures Triggers Types l l l l l Creating An
Assembly CREATE ASSEMBLY geom FROM ‘m1typesgeometry.dll’ ‘ m1types WITH PERMISSION_SET = SAFE WITH AUTOREGISTER DROP ASSEMBLY lib_geom l Assemblies stored in database Ø l Ø l Safe (default), external access, unrestricted Autoregister functions Ø l Backup, restore with data Code permissions assigned per assembly Using .NET custom attributes Assembly benefits Ø Ø SelfSelf-describing metadata: Types, file dependencies Unit of code deployment: Permissions, versioning PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 9
10.
Altering An Assembly l l Cannot
invalidate persistent data or indexes Implies Ø Ø l l No tables with columns of UDT from this assembly No indexes on functions of this assembly Force option allows ALTER even if persistent dependencies exist Packaging considerations Ø Place routines and types in different assemblies Creating A Function CREATE FUNCTION distance ( @x1 int, @y1 int, @x2 int, @y2 int ) RETURNS float int, int, int, EXTERNAL NAME ‘geom:CPoint.Distance’ ‘geom:CPoint.Distance’ DETERMINISTIC RETURNS NULL ON NULL INPUT DROP FUNCTION distance l Functions called from queries Ø Ø Ø l Can be scalar or table -valued Static class functions Deterministic functions Using a function in a query SELECT s.name FROM Supplier s WHERE dbo.distance ( s.x, s.y, @x, @y ) < 3 dbo.distance( PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 10
11.
Creating A Procedure CREATE
PROCEDURE check_inventory EXTERNAL NAME ‘events:CInventory.check_level’ ‘events:CInventory.check_level’ DROP PROCEDURE check_inventory l Procedures not called from queries Ø Ø Can contain SQL queries, updates or DDL Can return results directly to client Creating A Trigger CREATE TRIGGER supplier_event ON supplier AFTER INSERT, UPDATE EXTERNAL NAME ‘events:CNotif.Supp_Event’ ‘events:CNotif.Supp_Event’ DROP TRIGGER supplier_event l l Similar to procedures, plus Access to inserted, deleted tables PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 11
12.
Creating A Type l Create
or drop a type CREATE TYPE Point EXTERNAL NAME ‘geom:Point’ ‘geom:Point’ DROP TYPE Point l Using a type CREATE TABLE Supplier ( id INTEGER PRIMARY KEY, name VARCHAR(20), location Point ) l Using a type method in a query SELECT s.name FROM Supplier s WHERE s.location::distance( @point ) < 3 Query Optimization l Automatically gather function statistics Ø l Reorder of predicate evaluation Ø l Based on execution cost and statistics Function indexes Ø Ø l Value histograms, execution cost Speed up expensive functions Extends computed column indexes and index views Implied and residual predicates PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 12
13.
Summary Richer server programming
model l Ø Ø Ø Any .NET framework language Same mid - and server -tier data access: midserverADO. NET Same IDE, project model, debugging, tools SQL Server hosting of .NET runtime l Ø Safety, security, scalability, speed SQL Server .NET features l Ø Functions, stored procedures, triggers, types, aggregates Demos l l Sample code for function, stored procedure, and type Assemblies Ø l Functions and stored procedures Ø Ø l Safe versus external access Creation and execution Data access in-process via ADO .NET in- Types Ø Ø Ø Ø Ø Type contract Create type Create table with column of user-defined type userCreate index on column of user-defined type userInsert and query the table PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 13
14.
© 2001 Microsoft
Corporation. All rights reserved. PDC 2001 October 22-26, 2001 © 2001 Microsoft Corporation. All rights reserved. 14
Download now