SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Querying and Managing Data Using SQL Server 2005
Objectives


                In this session, you will learn to:
                   Understand managed code
                   Create managed database objects
                   Define the Hypertext Transfer Protocol endpoints
                   Implement the Hypertext Transfer Protocol endpoints for Web
                   services




     Ver. 1.0                        Session 16                         Slide 1 of 31
Querying and Managing Data Using SQL Server 2005
Introduction to SQL Server CLR Integration


                CLR integration:
                   Allows the database developer to write the code in any of
                   the .NET supported languages
                   Allows to run managed code within a database
                   Provides the following functions and services required for
                   program execution




     Ver. 1.0                        Session 16                            Slide 2 of 31
Querying and Managing Data Using SQL Server 2005
Identifying the Need for Managed Code


                Managed database objects can be created in the following
                situations:
                   To implement complicated programming logics
                   To access external resources
                   To implement a CPU-intensive functionality that can run more
                   efficiently as compared to the managed code.
                T-SQL statements can be used in the following situations:
                   To perform data access and manipulation operations that can
                   be done using the T-SQL statements.
                   To implement programming logic tat can be easily
                   implemented using T-SQL programming constructs.




     Ver. 1.0                       Session 16                          Slide 3 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following is supported by .NET and not by
                T-SQL?
                1.   Writing queries
                2.   Creating procedures
                3.   Object-Orientation
                4.   Writing triggers




                Answer:
                 3. Object-Orientation




     Ver. 1.0                       Session 16                      Slide 4 of 31
Querying and Managing Data Using SQL Server 2005
Importing and Configuring Assemblies


                Assemblies:
                   Are created to attach the managed code
                   Are created using the CREATE ASSEMBLY command
                Syntax:
                CREATE ASSEMBLY assembly_name
                FROM { <client_assembly_specifier> |
                <assembly_bits>
                [ ,...n ] }
                [ WITH PERMISSION_SET =
                { SAFE | EXTERNAL_ACCESS | UNSAFE } ]
                Let’s see how…



     Ver. 1.0                     Session 16                       Slide 5 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following PERMISSION_SET will you use to
                access another database server?
                1. SAFE
                2. EXTERNAL_ACCESS
                3. UNSAFE




                Answer:
                 2. EXTERNAL_ACCESS




     Ver. 1.0                     Session 16                     Slide 6 of 31
Querying and Managing Data Using SQL Server 2005
Creating Managed Database Objects


                Managed database objects can be of the following types:
                   Stored Procedures
                   Functions
                   Triggers
                   UDTs




     Ver. 1.0                      Session 16                      Slide 7 of 31
Querying and Managing Data Using SQL Server 2005
Creating Managed Database Objects (Contd.)


                Managed stored procedure:
                   Is implemented by creating a procedure that refers to an
                   imported assembly
                   Syntax:
                    CREATE PROCEDURE <Procedure Name>
                    AS EXTERNAL NAME <Assembly Identifier>.<Type
                    Name>.<Method Name>,
                Let’s see how…




     Ver. 1.0                      Session 16                        Slide 8 of 31
Querying and Managing Data Using SQL Server 2005
Creating Managed Database Objects (Contd.)


                Managed function:
                   Is implemented by creating a function that refers to an
                   imported assembly
                   Syntax:
                    CREATE FUNCTION <Function Name>
                    (
                      <Parameter List>
                    )
                    RETURNS <Return Type>
                    AS EXTERNAL NAME <Assembly Identifier>.<Type
                    Name>.<Method Name>
                Let’s see how…




     Ver. 1.0                        Session 16                              Slide 9 of 31
Querying and Managing Data Using SQL Server 2005
Creating Managed Database Objects (Contd.)


                Managed trigger:
                   Is implemented by creating a trigger that refers to an imported
                   assembly
                   Syntax:
                    CREATE TRIGGER <TriggerName>
                    ON <Table or View> <FOR | INSTEAD OF | AFTER>
                    < INSERT | UPDATE | DELETE >
                    AS EXTERNAL NAME <Assembly Identifier>.<Type
                    Name>.<Method Name>
                Let’s see how…




     Ver. 1.0                       Session 16                            Slide 10 of 31
Querying and Managing Data Using SQL Server 2005
Creating Managed Database Objects (Contd.)


                Managed user-defined type:
                   Is created by using the CREATE TYPE command
                   Syntax:
                    CREATE TYPE [ schema_name. ] type_name
                    {
                       FROM base_type [ (precision [ , scale ] ) ]
                       [ NULL | NOT NULL ]
                       | EXTERNAL NAME assembly_name[.class_name]
                    }
                Let’s see how…




     Ver. 1.0                    Session 16                 Slide 11 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                When will you use managed code instead of T-SQL?
                1. When you need to write queries.
                2. When you need to access external resources.
                3. When you need to perform an administrative task on the
                   database.




                Answer:
                2. When you need to access external resources.




     Ver. 1.0                      Session 16                          Slide 12 of 31
Querying and Managing Data Using SQL Server 2005
Demo: Implementing Managed User-Defined Types


               •   Problem Statement:
                      The management of AdventureWorks, Inc. has decided that
                      they want to include the details of the spouse of employees in
                      the database. The application that is used to enter the
                      employee detail will accept the name and date of birth of the
                      spouse of an employee. In addition, it will concatenate the two
                      values separated by a ";". As a database developer, you need
                      to store the spouse details in the following format:
                      Spouse Name: <name of the spouse> ; Spouse Date of Birth :
                      <date of birth>
                      To implement this, you have decided to create a managed
                      user-defined data type. How will you create this data type?




    Ver. 1.0                            Session 16                           Slide 13 of 31
Querying and Managing Data Using SQL Server 2005
Demo: Implementing Managed User-Defined Types (Contd.)


                Solution:
                   To solve the preceding problem, you need to perform the
                   following tasks:
                    1. Enable CLR in the database.
                    2. Create an assembly.
                    3. Create a managed database user-defined data type.
                    4. Create a table that will implement the user-defined data type.
                    5. Verify the output.




     Ver. 1.0                          Session 16                                Slide 14 of 31
Querying and Managing Data Using SQL Server 2005
Introduction to Service-Oriented Architecture (SOA)


                SOA:
                  Is an extension of distributed computing based on the
                  request/reply design pattern
                  Modularizes the business logic of an application and presents
                  them as services
                  Allows to create objects, such as, Web services that can be
                  accessed from heterogeneous systems




     Ver. 1.0                      Session 16                           Slide 15 of 31
Querying and Managing Data Using SQL Server 2005
Introduction to Web Services


                Flash presentation: Introduction to Web Services
                Web Service is a collection of methods that provide
                programmable logic used by client applications over the
                Internet.
                SQL Server 2005 provides native XML Web services by
                using the following open standards:
                   Hypertext Transfer Protocol (HTTP)
                   Simple Object Access Protocol (SOAP)
                   Web Services Definition Language (WSDL)




     Ver. 1.0                      Session 16                       Slide 16 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following describes the Web services?
                1. WSDL
                2. SOAP
                3. UDDI




                Answer:
                1. WSDL




     Ver. 1.0                     Session 16                         Slide 17 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                Which of the following helps in finding a Web service?
                1. WSDL
                2. SOAP
                3. UDDI




                Answer:
                3. UDDI




     Ver. 1.0                      Session 16                       Slide 18 of 31
Querying and Managing Data Using SQL Server 2005
Identifying the Role of HTTP Endpoints in Native Web Service Architecture


                 HTTP Endpoint:
                    Is the gateway through which HTTP-based clients can query
                    the database server
                    Created for use with SQL Server 2005 can listen and receive
                    requests on the TCP port (port 80)




      Ver. 1.0                       Session 16                          Slide 19 of 31
Querying and Managing Data Using SQL Server 2005
Identifying the Role of HTTP Endpoints in Native Web Service Architecture (Contd.)



                 HTTP Endpoint Architecture:




      Ver. 1.0                       Session 16                          Slide 20 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                On which of the following ports does the SQL Server listen
                for HTTP requests?
                 1. 80
                 2. 90
                 3. 70




                Answer:
                 1. 80




     Ver. 1.0                      Session 16                       Slide 21 of 31
Querying and Managing Data Using SQL Server 2005
Creating HTTP Endpoints


                Involves the following tasks:
                 1. Creating the required database code to access the data.
                 2. Creating an HTTP Endpoint using the CREATE ENDPOINT
                    statement.




     Ver. 1.0                       Session 16                        Slide 22 of 31
Querying and Managing Data Using SQL Server 2005
Creating HTTP Endpoints (Contd.)


                Syntax:
                CREATE ENDPOINT endpoint_name
                STATE = { STARTED | STOPPED | DISABLED }
                AS HTTP (
                AUTHENTICATION =( { BASIC | DIGEST |
                INTEGRATED | NTLM | KERBEROS },
                PATH = 'url', PORTS = (CLEAR) )
                FOR SOAP(
                [ { WEBMETHOD [ 'namespace' .] 'method_alias'
                (   NAME = 'database.owner.name'
                [ , SCHEMA = { NONE | STANDARD | DEFAULT } ]
                [ , FORMAT = { ALL_RESULTS | ROWSETS_ONLY } ])
                } [ ,...n ] ]
                [   BATCHES = { ENABLED | DISABLED } ]
                [ , WSDL = { NONE | DEFAULT | 'sp_name' } ]
                Let’s see how…

     Ver. 1.0                    Session 16               Slide 23 of 31
Querying and Managing Data Using SQL Server 2005
Just a minute


                While creating an HTTP Endpoint, which of the following
                format will you use to return only the result set to the user?
                 1. ROWSET_ONLY
                 2. ALL_RESULT
                 3. NONE




                Answer:
                 1. ROWSET_ONLY




     Ver. 1.0                       Session 16                         Slide 24 of 31
Querying and Managing Data Using SQL Server 2005
Demo: Implementing HTTP Endpoints


               • Problem Statement:
                    The database server of AdventureWorks, Inc. is located at
                    Bothell. The organization has various offices located at various
                    locations spread across the globe.
                    According to the requirements, the users need to access the
                    data of all the employees at various locations. Users might
                    need to use PDAs or mobile phones to access these details.
                    As a database developer, you have decided to implement a
                    Web service that allows the users to access the data using the
                    Internet.
                    How will you implement this service inside the AdventureWorks
                    database?




    Ver. 1.0                          Session 16                           Slide 25 of 31
Querying and Managing Data Using SQL Server 2005
Demo: Implementing HTTP Endpoints (Contd.)


                Solution:
                   To solve the preceding problem, you need to perform the
                   following tasks:
                    1. Create a procedure.
                    2. Create an HTTP Endpoint for SOAP.
                    3. Verify the creation of HTTP endpoint. `




     Ver. 1.0                          Session 16                       Slide 26 of 31
Querying and Managing Data Using SQL Server 2005
Summary


               In this session, you learned that:
                  The database objects created in any of the .NET supported
                  languages are called managed database objects.
                  CLR integration provides the following benefits:
                    • Better programming model
                    • Common development environment
                    • Ability to define data types
                  T-SQL can be used to perform data access and manipulation
                  operations that can be implemented using the programming
                  constructs provided by T-SQL.




    Ver. 1.0                       Session 16                         Slide 27 of 31
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               Managed database objects can be used in the following
               situations:
                   To implement complicated programming logic for which you can
                   reuse the functionality provided by the .NET base class libraries.
                   To access external resources, such as calling a Web service or
                   accessing the file system.
                   To implement a CPU-intensive functionality that can run more
                   efficiently as compared to the managed code.
               By default, the SQL Server does not allow running managed
               code on the server.
               Before creating a managed database object in your database,
               the CLR integration feature should be enabled in the database
               using the sp_configure stored procedure.
               The .NET code that is used to create the managed database
               objects is compiled in .NET assemblies, .dll or .exe files.
               To create a managed database object, first first the.NET
               assemblies are imported in the database engine.
    Ver. 1.0                      Session 16                                 Slide 28 of 31
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               The assemblies in the database engine can be given any of the
               following three permissions:
                   SAFE
                   EXTERNAL_ACCESS
                   UNSAFE
               Managed stored procedure can be created using the CREATE
               PROCEDURE command.
               Managed function can be created using the CREATE
               FUNCTION command.
               Managed trigger can be created using the CREATE TRIGGER
               command.
               Managed data type can be created using the CREATE TYPE
               command.
               A Web service is the piece of code that is exposed over the
               Internet.


    Ver. 1.0                    Session 16                          Slide 29 of 31
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               Web services have following advantages:
                • Interoperability
                • Multilanguage support
                • Reusing existing applications
               SOAP is a standard communication protocol to interchange
               information in a structured format in a distributed environment.
               WSDL is a markup language that describes a Web service.
               UDDI provides a standard mechanism to register and discover
               a Web service.
               HTTP endpoints allow you to create and use Web services
               within the SQL Server.
               Before creating an HTTP endpoint, you need to first create
               stored procedures or functions that form a Web service.




    Ver. 1.0                      Session 16                           Slide 30 of 31
Querying and Managing Data Using SQL Server 2005
Summary (Contd.)


               HTTP endpoints provide the users with a connecting point
               through which they can access the implemented functions.
               You can create HTTP endpoints by using the CREATE
               ENDPOINT statement.




    Ver. 1.0                   Session 16                          Slide 31 of 31

Weitere ähnliche Inhalte

Was ist angesagt?

Oracle Database Security For Developers
Oracle Database Security For DevelopersOracle Database Security For Developers
Oracle Database Security For DevelopersSzymon Skorupinski
 
Ado.net session04
Ado.net session04Ado.net session04
Ado.net session04Niit Care
 
Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3IMC Institute
 
Ado.net session05
Ado.net session05Ado.net session05
Ado.net session05Niit Care
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Bernardo Damele A. G.
 
Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...malu42
 
Reviewing sql server permissions tech republic
Reviewing sql server permissions   tech republicReviewing sql server permissions   tech republic
Reviewing sql server permissions tech republicKaing Menglieng
 
MSI Run-Time Logging and Debugging
MSI Run-Time Logging and DebuggingMSI Run-Time Logging and Debugging
MSI Run-Time Logging and DebuggingFlexera
 
Installing 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxInstalling 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxAnar Godjaev
 
Oracle database locking mechanism demystified (AOUG)
Oracle database locking mechanism demystified (AOUG)Oracle database locking mechanism demystified (AOUG)
Oracle database locking mechanism demystified (AOUG)Pini Dibask
 
3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asksPramod Singla
 
android sqlite
android sqliteandroid sqlite
android sqliteDeepa Rani
 

Was ist angesagt? (18)

SQL2SPARQL
SQL2SPARQLSQL2SPARQL
SQL2SPARQL
 
Oracle Database Security For Developers
Oracle Database Security For DevelopersOracle Database Security For Developers
Oracle Database Security For Developers
 
Ado.net session04
Ado.net session04Ado.net session04
Ado.net session04
 
Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3Java Web Programming Using Cloud Platform: Module 3
Java Web Programming Using Cloud Platform: Module 3
 
Ado.net session05
Ado.net session05Ado.net session05
Ado.net session05
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)Advanced SQL injection to operating system full control (whitepaper)
Advanced SQL injection to operating system full control (whitepaper)
 
Android sql examples
Android sql examplesAndroid sql examples
Android sql examples
 
Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...
 
181 Pdfsam
181 Pdfsam181 Pdfsam
181 Pdfsam
 
Reviewing sql server permissions tech republic
Reviewing sql server permissions   tech republicReviewing sql server permissions   tech republic
Reviewing sql server permissions tech republic
 
MSI Run-Time Logging and Debugging
MSI Run-Time Logging and DebuggingMSI Run-Time Logging and Debugging
MSI Run-Time Logging and Debugging
 
Ado.net
Ado.netAdo.net
Ado.net
 
Installing 12c R1 database on oracle linux
Installing 12c R1 database on oracle linuxInstalling 12c R1 database on oracle linux
Installing 12c R1 database on oracle linux
 
Chapter6 database connectivity
Chapter6 database connectivityChapter6 database connectivity
Chapter6 database connectivity
 
Oracle database locking mechanism demystified (AOUG)
Oracle database locking mechanism demystified (AOUG)Oracle database locking mechanism demystified (AOUG)
Oracle database locking mechanism demystified (AOUG)
 
3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks3.1\9 SSIS 2008R2_Training - ControlFlow asks
3.1\9 SSIS 2008R2_Training - ControlFlow asks
 
android sqlite
android sqliteandroid sqlite
android sqlite
 

Andere mochten auch

Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junio
Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junioPymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junio
Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junioCarmen Urbano
 
Ley general de educación panorama
Ley general de educación   panoramaLey general de educación   panorama
Ley general de educación panoramaandresienriquez
 
Internacionalizacion de la pyme via exportaciones por correos.
Internacionalizacion de la pyme via exportaciones por correos.Internacionalizacion de la pyme via exportaciones por correos.
Internacionalizacion de la pyme via exportaciones por correos.JAIME ALBUJA
 
Mohammadzadeh's Portfoilo
Mohammadzadeh's PortfoiloMohammadzadeh's Portfoilo
Mohammadzadeh's PortfoiloMilud Zadeh
 
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...Carmen Urbano
 
Sea exaltado en el cielo
Sea exaltado en el cieloSea exaltado en el cielo
Sea exaltado en el cieloJose Cortes
 
How to Analyze, Measure and Optimize Non-Profit Websites
How to Analyze, Measure and Optimize Non-Profit WebsitesHow to Analyze, Measure and Optimize Non-Profit Websites
How to Analyze, Measure and Optimize Non-Profit WebsitesAntoaneta Nikolaeva
 
Collection of Good Practices in Territorial Marketing, PADIMA European Project.
Collection of Good Practices in Territorial Marketing, PADIMA European Project.Collection of Good Practices in Territorial Marketing, PADIMA European Project.
Collection of Good Practices in Territorial Marketing, PADIMA European Project.Carmen Urbano
 
Turismo Territorial. Teruel (España) brochure
Turismo Territorial. Teruel (España) brochureTurismo Territorial. Teruel (España) brochure
Turismo Territorial. Teruel (España) brochureCarmen Urbano
 
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent..."La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...Carmen Urbano
 
Web analytics and conversion optimization toolbox
Web analytics and conversion optimization toolboxWeb analytics and conversion optimization toolbox
Web analytics and conversion optimization toolboxAntoaneta Nikolaeva
 
Comp tia n+_session_06
Comp tia n+_session_06Comp tia n+_session_06
Comp tia n+_session_06Niit Care
 

Andere mochten auch (20)

Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junio
Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junioPymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junio
Pymes, transformación digital e internacionalizacion. CEEI Aragon - 8 junio
 
Estepona
EsteponaEstepona
Estepona
 
Ley general de educación panorama
Ley general de educación   panoramaLey general de educación   panorama
Ley general de educación panorama
 
Internacionalizacion de la pyme via exportaciones por correos.
Internacionalizacion de la pyme via exportaciones por correos.Internacionalizacion de la pyme via exportaciones por correos.
Internacionalizacion de la pyme via exportaciones por correos.
 
Zwa omadaa
Zwa omadaaZwa omadaa
Zwa omadaa
 
Mohammadzadeh's Portfoilo
Mohammadzadeh's PortfoiloMohammadzadeh's Portfoilo
Mohammadzadeh's Portfoilo
 
TTC Events Website
TTC Events WebsiteTTC Events Website
TTC Events Website
 
Informe auditoria externa concurrente agosto 2014 mayo 2015
Informe auditoria externa concurrente agosto 2014 mayo 2015Informe auditoria externa concurrente agosto 2014 mayo 2015
Informe auditoria externa concurrente agosto 2014 mayo 2015
 
Taller
TallerTaller
Taller
 
σχολικη βια
σχολικη βιασχολικη βια
σχολικη βια
 
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...
Emprendedores e Internacionalización. Misión a Toulouse 26 y 27 de marzo. Zar...
 
Sea exaltado en el cielo
Sea exaltado en el cieloSea exaltado en el cielo
Sea exaltado en el cielo
 
How to Analyze, Measure and Optimize Non-Profit Websites
How to Analyze, Measure and Optimize Non-Profit WebsitesHow to Analyze, Measure and Optimize Non-Profit Websites
How to Analyze, Measure and Optimize Non-Profit Websites
 
Collection of Good Practices in Territorial Marketing, PADIMA European Project.
Collection of Good Practices in Territorial Marketing, PADIMA European Project.Collection of Good Practices in Territorial Marketing, PADIMA European Project.
Collection of Good Practices in Territorial Marketing, PADIMA European Project.
 
Ds 3
Ds 3Ds 3
Ds 3
 
Turismo Territorial. Teruel (España) brochure
Turismo Territorial. Teruel (España) brochureTurismo Territorial. Teruel (España) brochure
Turismo Territorial. Teruel (España) brochure
 
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent..."La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...
"La internacionalizacion es responsabilidad de todos", por Carmen Urbano (ent...
 
Web analytics and conversion optimization toolbox
Web analytics and conversion optimization toolboxWeb analytics and conversion optimization toolbox
Web analytics and conversion optimization toolbox
 
Comp tia n+_session_06
Comp tia n+_session_06Comp tia n+_session_06
Comp tia n+_session_06
 
Portada
PortadaPortada
Portada
 

Ähnlich wie 11 qmds2005 session16

10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14Niit Care
 
03 qmds2005 session03
03 qmds2005 session0303 qmds2005 session03
03 qmds2005 session03Niit Care
 
01 qmds2005 session01
01 qmds2005 session0101 qmds2005 session01
01 qmds2005 session01Niit Care
 
05 qmds2005 session07
05 qmds2005 session0705 qmds2005 session07
05 qmds2005 session07Niit Care
 
23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqraijaprr_editor
 
05 entity framework
05 entity framework05 entity framework
05 entity frameworkglubox
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developerswebhostingguy
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hydewebhostingguy
 
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersSQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersTobias Koprowski
 
13 qmds2005 session18
13 qmds2005 session1813 qmds2005 session18
13 qmds2005 session18Niit Care
 
Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Netwebhostingguy
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufCTE Solutions Inc.
 
RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...RightScale
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL IISankhya_Analytics
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxsamtakke1
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity FrameworksRich Helton
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )Rajput Rajnish
 
SQL Server 2008 Security Overview
SQL Server 2008 Security OverviewSQL Server 2008 Security Overview
SQL Server 2008 Security Overviewukdpe
 

Ähnlich wie 11 qmds2005 session16 (20)

10 qmds2005 session14
10 qmds2005 session1410 qmds2005 session14
10 qmds2005 session14
 
03 qmds2005 session03
03 qmds2005 session0303 qmds2005 session03
03 qmds2005 session03
 
01 qmds2005 session01
01 qmds2005 session0101 qmds2005 session01
01 qmds2005 session01
 
05 qmds2005 session07
05 qmds2005 session0705 qmds2005 session07
05 qmds2005 session07
 
23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra23 ijaprr vol1-3-25-31iqra
23 ijaprr vol1-3-25-31iqra
 
05 entity framework
05 entity framework05 entity framework
05 entity framework
 
FREE Sql Server syllabus
FREE Sql Server syllabusFREE Sql Server syllabus
FREE Sql Server syllabus
 
SQLCLR For DBAs and Developers
SQLCLR For DBAs and DevelopersSQLCLR For DBAs and Developers
SQLCLR For DBAs and Developers
 
Dr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. HydeDr. Jekyll and Mr. Hyde
Dr. Jekyll and Mr. Hyde
 
Day2
Day2Day2
Day2
 
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginnersSQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
SQLSaturday#290_Kiev_WindowsAzureDatabaseForBeginners
 
13 qmds2005 session18
13 qmds2005 session1813 qmds2005 session18
13 qmds2005 session18
 
Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
 
Session 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian MalbeufSession 2: SQL Server 2012 with Christian Malbeuf
Session 2: SQL Server 2012 with Christian Malbeuf
 
RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...RightScale Webinar: Best Practices: Software Development Strategies Using Win...
RightScale Webinar: Best Practices: Software Development Strategies Using Win...
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL II
 
Microsoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptxMicrosoft SQL Server Database Administration.pptx
Microsoft SQL Server Database Administration.pptx
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity Frameworks
 
Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
 
SQL Server 2008 Security Overview
SQL Server 2008 Security OverviewSQL Server 2008 Security Overview
SQL Server 2008 Security Overview
 

Mehr von Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Kürzlich hochgeladen

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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 educationjfdjdjcjdnsjd
 
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 Processorsdebabhi2
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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
 
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
 

Kürzlich hochgeladen (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
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
 

11 qmds2005 session16

  • 1. Querying and Managing Data Using SQL Server 2005 Objectives In this session, you will learn to: Understand managed code Create managed database objects Define the Hypertext Transfer Protocol endpoints Implement the Hypertext Transfer Protocol endpoints for Web services Ver. 1.0 Session 16 Slide 1 of 31
  • 2. Querying and Managing Data Using SQL Server 2005 Introduction to SQL Server CLR Integration CLR integration: Allows the database developer to write the code in any of the .NET supported languages Allows to run managed code within a database Provides the following functions and services required for program execution Ver. 1.0 Session 16 Slide 2 of 31
  • 3. Querying and Managing Data Using SQL Server 2005 Identifying the Need for Managed Code Managed database objects can be created in the following situations: To implement complicated programming logics To access external resources To implement a CPU-intensive functionality that can run more efficiently as compared to the managed code. T-SQL statements can be used in the following situations: To perform data access and manipulation operations that can be done using the T-SQL statements. To implement programming logic tat can be easily implemented using T-SQL programming constructs. Ver. 1.0 Session 16 Slide 3 of 31
  • 4. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following is supported by .NET and not by T-SQL? 1. Writing queries 2. Creating procedures 3. Object-Orientation 4. Writing triggers Answer: 3. Object-Orientation Ver. 1.0 Session 16 Slide 4 of 31
  • 5. Querying and Managing Data Using SQL Server 2005 Importing and Configuring Assemblies Assemblies: Are created to attach the managed code Are created using the CREATE ASSEMBLY command Syntax: CREATE ASSEMBLY assembly_name FROM { <client_assembly_specifier> | <assembly_bits> [ ,...n ] } [ WITH PERMISSION_SET = { SAFE | EXTERNAL_ACCESS | UNSAFE } ] Let’s see how… Ver. 1.0 Session 16 Slide 5 of 31
  • 6. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following PERMISSION_SET will you use to access another database server? 1. SAFE 2. EXTERNAL_ACCESS 3. UNSAFE Answer: 2. EXTERNAL_ACCESS Ver. 1.0 Session 16 Slide 6 of 31
  • 7. Querying and Managing Data Using SQL Server 2005 Creating Managed Database Objects Managed database objects can be of the following types: Stored Procedures Functions Triggers UDTs Ver. 1.0 Session 16 Slide 7 of 31
  • 8. Querying and Managing Data Using SQL Server 2005 Creating Managed Database Objects (Contd.) Managed stored procedure: Is implemented by creating a procedure that refers to an imported assembly Syntax: CREATE PROCEDURE <Procedure Name> AS EXTERNAL NAME <Assembly Identifier>.<Type Name>.<Method Name>, Let’s see how… Ver. 1.0 Session 16 Slide 8 of 31
  • 9. Querying and Managing Data Using SQL Server 2005 Creating Managed Database Objects (Contd.) Managed function: Is implemented by creating a function that refers to an imported assembly Syntax: CREATE FUNCTION <Function Name> ( <Parameter List> ) RETURNS <Return Type> AS EXTERNAL NAME <Assembly Identifier>.<Type Name>.<Method Name> Let’s see how… Ver. 1.0 Session 16 Slide 9 of 31
  • 10. Querying and Managing Data Using SQL Server 2005 Creating Managed Database Objects (Contd.) Managed trigger: Is implemented by creating a trigger that refers to an imported assembly Syntax: CREATE TRIGGER <TriggerName> ON <Table or View> <FOR | INSTEAD OF | AFTER> < INSERT | UPDATE | DELETE > AS EXTERNAL NAME <Assembly Identifier>.<Type Name>.<Method Name> Let’s see how… Ver. 1.0 Session 16 Slide 10 of 31
  • 11. Querying and Managing Data Using SQL Server 2005 Creating Managed Database Objects (Contd.) Managed user-defined type: Is created by using the CREATE TYPE command Syntax: CREATE TYPE [ schema_name. ] type_name { FROM base_type [ (precision [ , scale ] ) ] [ NULL | NOT NULL ] | EXTERNAL NAME assembly_name[.class_name] } Let’s see how… Ver. 1.0 Session 16 Slide 11 of 31
  • 12. Querying and Managing Data Using SQL Server 2005 Just a minute When will you use managed code instead of T-SQL? 1. When you need to write queries. 2. When you need to access external resources. 3. When you need to perform an administrative task on the database. Answer: 2. When you need to access external resources. Ver. 1.0 Session 16 Slide 12 of 31
  • 13. Querying and Managing Data Using SQL Server 2005 Demo: Implementing Managed User-Defined Types • Problem Statement: The management of AdventureWorks, Inc. has decided that they want to include the details of the spouse of employees in the database. The application that is used to enter the employee detail will accept the name and date of birth of the spouse of an employee. In addition, it will concatenate the two values separated by a ";". As a database developer, you need to store the spouse details in the following format: Spouse Name: <name of the spouse> ; Spouse Date of Birth : <date of birth> To implement this, you have decided to create a managed user-defined data type. How will you create this data type? Ver. 1.0 Session 16 Slide 13 of 31
  • 14. Querying and Managing Data Using SQL Server 2005 Demo: Implementing Managed User-Defined Types (Contd.) Solution: To solve the preceding problem, you need to perform the following tasks: 1. Enable CLR in the database. 2. Create an assembly. 3. Create a managed database user-defined data type. 4. Create a table that will implement the user-defined data type. 5. Verify the output. Ver. 1.0 Session 16 Slide 14 of 31
  • 15. Querying and Managing Data Using SQL Server 2005 Introduction to Service-Oriented Architecture (SOA) SOA: Is an extension of distributed computing based on the request/reply design pattern Modularizes the business logic of an application and presents them as services Allows to create objects, such as, Web services that can be accessed from heterogeneous systems Ver. 1.0 Session 16 Slide 15 of 31
  • 16. Querying and Managing Data Using SQL Server 2005 Introduction to Web Services Flash presentation: Introduction to Web Services Web Service is a collection of methods that provide programmable logic used by client applications over the Internet. SQL Server 2005 provides native XML Web services by using the following open standards: Hypertext Transfer Protocol (HTTP) Simple Object Access Protocol (SOAP) Web Services Definition Language (WSDL) Ver. 1.0 Session 16 Slide 16 of 31
  • 17. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following describes the Web services? 1. WSDL 2. SOAP 3. UDDI Answer: 1. WSDL Ver. 1.0 Session 16 Slide 17 of 31
  • 18. Querying and Managing Data Using SQL Server 2005 Just a minute Which of the following helps in finding a Web service? 1. WSDL 2. SOAP 3. UDDI Answer: 3. UDDI Ver. 1.0 Session 16 Slide 18 of 31
  • 19. Querying and Managing Data Using SQL Server 2005 Identifying the Role of HTTP Endpoints in Native Web Service Architecture HTTP Endpoint: Is the gateway through which HTTP-based clients can query the database server Created for use with SQL Server 2005 can listen and receive requests on the TCP port (port 80) Ver. 1.0 Session 16 Slide 19 of 31
  • 20. Querying and Managing Data Using SQL Server 2005 Identifying the Role of HTTP Endpoints in Native Web Service Architecture (Contd.) HTTP Endpoint Architecture: Ver. 1.0 Session 16 Slide 20 of 31
  • 21. Querying and Managing Data Using SQL Server 2005 Just a minute On which of the following ports does the SQL Server listen for HTTP requests? 1. 80 2. 90 3. 70 Answer: 1. 80 Ver. 1.0 Session 16 Slide 21 of 31
  • 22. Querying and Managing Data Using SQL Server 2005 Creating HTTP Endpoints Involves the following tasks: 1. Creating the required database code to access the data. 2. Creating an HTTP Endpoint using the CREATE ENDPOINT statement. Ver. 1.0 Session 16 Slide 22 of 31
  • 23. Querying and Managing Data Using SQL Server 2005 Creating HTTP Endpoints (Contd.) Syntax: CREATE ENDPOINT endpoint_name STATE = { STARTED | STOPPED | DISABLED } AS HTTP ( AUTHENTICATION =( { BASIC | DIGEST | INTEGRATED | NTLM | KERBEROS }, PATH = 'url', PORTS = (CLEAR) ) FOR SOAP( [ { WEBMETHOD [ 'namespace' .] 'method_alias' ( NAME = 'database.owner.name' [ , SCHEMA = { NONE | STANDARD | DEFAULT } ] [ , FORMAT = { ALL_RESULTS | ROWSETS_ONLY } ]) } [ ,...n ] ] [ BATCHES = { ENABLED | DISABLED } ] [ , WSDL = { NONE | DEFAULT | 'sp_name' } ] Let’s see how… Ver. 1.0 Session 16 Slide 23 of 31
  • 24. Querying and Managing Data Using SQL Server 2005 Just a minute While creating an HTTP Endpoint, which of the following format will you use to return only the result set to the user? 1. ROWSET_ONLY 2. ALL_RESULT 3. NONE Answer: 1. ROWSET_ONLY Ver. 1.0 Session 16 Slide 24 of 31
  • 25. Querying and Managing Data Using SQL Server 2005 Demo: Implementing HTTP Endpoints • Problem Statement: The database server of AdventureWorks, Inc. is located at Bothell. The organization has various offices located at various locations spread across the globe. According to the requirements, the users need to access the data of all the employees at various locations. Users might need to use PDAs or mobile phones to access these details. As a database developer, you have decided to implement a Web service that allows the users to access the data using the Internet. How will you implement this service inside the AdventureWorks database? Ver. 1.0 Session 16 Slide 25 of 31
  • 26. Querying and Managing Data Using SQL Server 2005 Demo: Implementing HTTP Endpoints (Contd.) Solution: To solve the preceding problem, you need to perform the following tasks: 1. Create a procedure. 2. Create an HTTP Endpoint for SOAP. 3. Verify the creation of HTTP endpoint. ` Ver. 1.0 Session 16 Slide 26 of 31
  • 27. Querying and Managing Data Using SQL Server 2005 Summary In this session, you learned that: The database objects created in any of the .NET supported languages are called managed database objects. CLR integration provides the following benefits: • Better programming model • Common development environment • Ability to define data types T-SQL can be used to perform data access and manipulation operations that can be implemented using the programming constructs provided by T-SQL. Ver. 1.0 Session 16 Slide 27 of 31
  • 28. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) Managed database objects can be used in the following situations: To implement complicated programming logic for which you can reuse the functionality provided by the .NET base class libraries. To access external resources, such as calling a Web service or accessing the file system. To implement a CPU-intensive functionality that can run more efficiently as compared to the managed code. By default, the SQL Server does not allow running managed code on the server. Before creating a managed database object in your database, the CLR integration feature should be enabled in the database using the sp_configure stored procedure. The .NET code that is used to create the managed database objects is compiled in .NET assemblies, .dll or .exe files. To create a managed database object, first first the.NET assemblies are imported in the database engine. Ver. 1.0 Session 16 Slide 28 of 31
  • 29. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) The assemblies in the database engine can be given any of the following three permissions: SAFE EXTERNAL_ACCESS UNSAFE Managed stored procedure can be created using the CREATE PROCEDURE command. Managed function can be created using the CREATE FUNCTION command. Managed trigger can be created using the CREATE TRIGGER command. Managed data type can be created using the CREATE TYPE command. A Web service is the piece of code that is exposed over the Internet. Ver. 1.0 Session 16 Slide 29 of 31
  • 30. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) Web services have following advantages: • Interoperability • Multilanguage support • Reusing existing applications SOAP is a standard communication protocol to interchange information in a structured format in a distributed environment. WSDL is a markup language that describes a Web service. UDDI provides a standard mechanism to register and discover a Web service. HTTP endpoints allow you to create and use Web services within the SQL Server. Before creating an HTTP endpoint, you need to first create stored procedures or functions that form a Web service. Ver. 1.0 Session 16 Slide 30 of 31
  • 31. Querying and Managing Data Using SQL Server 2005 Summary (Contd.) HTTP endpoints provide the users with a connecting point through which they can access the implemented functions. You can create HTTP endpoints by using the CREATE ENDPOINT statement. Ver. 1.0 Session 16 Slide 31 of 31

Hinweis der Redaktion

  1. Start the session by sharing the objectives with the students.
  2. In this slide, you need to explain the students about CLR. As they have already read about CLR in the previous module, you need not to go into the details of CLR. In addition, you also need to explain them that CLR has now been incorporated in the SQL Server itself. Also explain the students about the benefits of integrating CLR inside SQL Server itself. You can use the examples provided in the Student Guide to clarify the concept to the students. Additional Inputs T-SQL has been the conventional language to write database objects, such as stored procedure, triggers and functions. SQL Server 2005 provides the new possibilities to the database developer by integrating .NET Framework in it. SQL Server 2005 allows the database developers to write stored procedures, triggers, user-defined types, user-defined aggregates, and user-defined functions in any of the .NET supported language, build a dll, register and use it inside a SQL Server.
  3. In this slide, you need to explain the need for managed code to the students. You need to explain the limitations of T-SQL to the students, and how those limitations can be overcome by the introducing managed code in SQL Server. Additional Input T-SQL is a great language to manipulate and query data from a database server, and working on set-based operations. It provides a number of database features
  4. Example: You have created a managed code and saved it as CLRIntegration.dll. To create an assembly for this dll, you can write the following code: CREATE ASSEMBLY CLRIntegration FROM ‘ C:\\CLRIntegration\\CLRIntegration.dll’ WITH PERMISSION_SET = SAFE
  5. For example, the employees data stored in the database need to be converted into an XML file. For this purpose, you need to create a function that will read the data from the table and write it inside the XML file. As you need to access an external file, you need to create a managed procedure.
  6. For Example, you need a function that accepts Employee Id as an input, does all the processing, and finally displays the actual salary of that employee for current month. The processing includes, adding all the components of the salary, checking and adjusting the salary according to the attendance, and deducting the provident fund contribution. Writing this code in T-SQL is very complicated, as it involves a number of decisions and a number of processing. You can create a managed function that accepts employee code and returns the actual salary.
  7. For Example, you want that whenever a new database object is added in the AdventureWorks database, the same should be added in the list of the database objects available with the database administrator. The list of database objects is stored in a text file with the DBA.
  8. For Example, You need to create a data type to store the zip code of addresses of the employees. You also want if user enters valid code, the name of the state is stored in the column else an error message should be displayed. Creating such a UDT is very complicated in SQL Server, for this purpose you will create a Managed UDT.
  9. Do not go into the depth of SOAD, WSDL, and UDDI. Just try to clear the concept of Web Services to the student.
  10. Example: You have created a function that returns the day as number. To create a new endpoint named sqlEndpoint, you need to use the following code in SQL Server. CREATE ENDPOINT sql_endpoint STATE = STARTED AS HTTP( PATH = &apos;/sql&apos;, AUTHENTICATION = (INTEGRATED ), PORTS = ( CLEAR ), SITE = &apos;SERVER&apos; ) FOR SOAP ( WEBMETHOD &apos;GetSqlInfo&apos; (name=&apos;master.dbo.xp_msver&apos;, SCHEMA=STANDARD ), WEBMETHOD &apos;DayAsNumber&apos; (name=&apos;master.sys.fn_MSdayasnumber&apos;), WSDL = DEFAULT, SCHEMA = STANDARD, DATABASE = &apos;master&apos;, NAMESPACE = &apos;http://tempUri.org/&apos; );
  11. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  12. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  13. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  14. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.