Sql 2008 For Developers


Published on

This slide deck is for Developers who are interestedin learning what is new in SQL 2008

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Sql 2008 For Developers

  1. 1. MSDN Events Autumn, 2008 Building Applications with SQL Server 2008
  2. 2. What Will We Cover? • SQL Server Spatial support • T-SQL Enhancements • Visual Studio integration • SQL CLR • Reporting Services
  3. 3. Helpful Experience • SQL Server database development • .NET Framework application development • Visual Studio 2008 • Windows Presentation Foundation • ASP.NET • Microsoft Virtual Earth • OpenGIS
  4. 4. Agenda • SQL Server 2008 – New features – Enhancements – Programming • Demos!
  5. 5. What is Spatial Data? • Spatial data represents locations – Which properties overlap? – Which roads intersect property or each other? – How many stores/restaurants/houses/car dealerships are located within a geographical area? • Represented by two primary data types – Geometry: small areas where curvature of the Earth isn’t so relevant when making calculations • Flat Earth model • X, Y coordinates – Geography: large areas where the curvature of the Earth does matter when making calculations • Round Earth model • Latitude and longitude coordinates
  6. 6. What is Spatial Data? • You query for location information as you would any SQL Server data type – Data types dictated by the OpenGIS standard – Calculations easy to perform (“black box”)
  7. 7. Representing Spatial Data • Geospatial data in SQL Server – Stored in a proprietary binary format – Can be input using simple text • Parse methods exist to convert the text into the internal storage format – Represents areas using • Points • Linestrings • Polygons • MultiPoints • MultiLinestrings • MultiPolygons • GeomCollections
  8. 8. Representing Spatial Data • Polygonal areas must be defined in counter-clockwise direction – Interior areas (“holes”) must be defined in clockwise direction • Inherently support various calculations and methods – Spatial Reference ID (SRID) identifies ellipsoid used (flat/round, meters/feet) – Only instances with like SRID can be directly compared
  9. 9. Geographical Data • GEOGRAPHY type has additional requirements – Coordinate order is longitude/latitude – A single GEOGRAPHY object cannot span more than a logical hemisphere • Will throw exceptions if too large
  10. 10. Demo SQL Server Geospatial and Virtual Earth
  11. 11. Enhancements to T-SQL • Table Value Parameters • New Date/Time types • Time zone awareness • New MERGE keyword • New shorthand notation
  12. 12. Table Value Parameters • TVPs are used to insert/update multiple tables at one time – Multiple tables can be inserted/updated within a single transaction – MARS-like capability for writing • ADO.NET updated to include support – New parameter type: SqlDbType.Structured
  13. 13. Dates and Time • Several new types added – datetime2 – date – time – datetimeoffset • New functions added – CONVERT – SYS* Functions – DATEDIFF
  14. 14. MERGE • MERGE allows for insert, update, delete with one keyword – Merge two tables, source and target – Target table will be modified based on contents of source table • Syntax and use can be complex! – Be sure to review SQL Server Books Online for more details
  15. 15. Shorthand Notation • Allows you to declare a variable and assign a value in one line of code – More like contemporary programming languages, C# or Visual Basic .NET
  16. 16. Demo T-SQL Enhancements
  17. 17. Visual Studio Integration • Enhanced project types – Analysis Services – Reporting Services • Entity Framework
  18. 18. Entity Framework • Essentially an OR/M tool • Models relational data using entities – Can model any relational data source for data access (provider may be required) – Application-specific domain – You can work at a higher level of abstraction – Appropriate amount of information returned – Lazy-loaded • What is an entity? – Structurally like an object • Has scalars and relationships • Has identity – Represent nouns in your application domain
  19. 19. Demo Visual Studio Integration
  20. 20. SQL CLR • SQL Server has the ability to execute managed code – Stored procedures – Functions – Aggregates – Table value functions – User-defined types – Triggers • Visual Studio can manage both creation and deployment • SQL CLR is “off by default” for security reasons • Can be remotely debugged • With great power comes great responsibility – Your code executes in the SQL Server processing stream
  21. 21. Programming SQL CLR • Visual Studio provides templates for the various SQL CLR constructs – Uses Database project type – Simply “add new” like any other item you might add • Metadata controls SQL Server behavior – Attributes control programmatical type • Microsoft.SqlServer.Server.SqlProcedure • Microsoft.SqlServer.Server.SqlFunction • Microsoft.SqlServer.Server.SqlUserDefinedAggregate • Microsoft.SqlServer.Server.SqlTrigger • Microsoft.SqlServer.Server.SqlUserDefinedType
  22. 22. Programming SQL CLR • You write your logic using a .NET-supported language • You work with other objects in the Microsoft.SqlServer.Server namespace to retrieve and return data • Very ADO.NET-like, but not ADO.NET • Can be assigned security levels – Safe, External, Unsafe
  23. 23. Demo SQL CLR
  24. 24. Reporting Services • SQL Server standard for reporting – Managed enterprise reporting – Ad-hoc reporting – Embedded reporting – Web-based reporting • Reports can be formatted in a variety of ways – PDF – Word 2007 – HTML • Reports are exposed via a Web Service – Can be integrated with SharePoint – Dependency on IIS removed (uses http.sys)
  25. 25. Programming Reports • Strong designer and wizard support in Visual Studio • Enhanced configuration and administration tool • Design reports in Visual Studio 2008 SP1 – Query for data – Assign query results to report – Design report style • Colors • Fonts – Deploy report • Web Service • SharePoint Services • Wizard available for initial report design
  26. 26. Demo Reporting Services
  27. 27. For More Information • Visit MSDN at msdn.microsoft.com
  28. 28. Microsoft Press Publications For the latest titles, visit www.microsoft.com/learning/books/devtools
  29. 29. Non-Microsoft Publications These books can be found and purchased at all major book stores and online retailers
  30. 30. RAMP-UP Are you ready to take your career as a developer to the next level? Looking for a learning experience that is designed for you? Join MSDN Ramp Up and Summit Your Career! MSDN Ramp Up is your online source that provides free training and technical resources to help take your development skills to the next level. • Step-by-Step training plans to build your development skills. • Premium technical content created by expert developers for developers. • Access to valuable online e-learning, e-references, and virtual labs. • 50% discount on select certification exams and 30% discount on Microsoft Press training kits. Join Ramp Up for free today! Go to: http://msdn.microsoft.com/rampup
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.