Eric Nelson Developer Evangelist [email protected]– I will reply http://blogs.msdn.com/ericnel - tends to be about .NET and data http://blogs.msdn.com/goto100 - all about Visual Basic http://twitter.com/ericnel - pot luck :-) http://blogs.msdn.com/ukdevevents The ONLY LINK you
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Eric NelsonDeveloper [email protected] – I will replyhttp://blogs.msdn.com/ericnel - tends to be about .NET and datahttp://blogs.msdn.com/goto100 - all about Visual Basichttp://twitter.com/ericnel - pot luck :-)http://blogs.msdn.com/ukdevevents The ONLY LINK you need!
1. First PC – ZX80 in 1980 (then BBC Micro, Atari 520STFM and Macintosh LC)
2. First computer job... FORTAN in 19863. Wrote most LOC on... Unix using C4. Favourite IDE of all time ...GNU Emacs5. Joined Microsoft DRG in 19966. Early adoption work on ASP, SQL 6.5, MTS...7. Went “Back to development” in July 2008 – in VB8. I Geek to Live (not Live to Geek)9. I am editor of the UK MSDN Flash10. I am fascinated by ALT.NET values and practices
http://blogs.msdn.com/ukdevevents The ONLY LINK you need!
Single statement that combines multiple DML operationsOperates on a join between source and targetSQL-2006 compliant
UPDATE TGT SET TGT.quantity = TGT.quantity + SRC.quantity, TGT.LastTradeDate = SRC.TradeDateFROM dbo.StockHolding AS TGT JOIN dbo.StockTrading AS SRC ON TGT.stock = SRC.stock;
INSERT INTO dbo.StockHolding (stock, lasttradedate, quantity) SELECT stock, tradedate, quantity FROM dbo.StockTrading AS SRC WHERE NOT EXISTS (SELECT * FROM dbo.StockHolding AS TGT WHERE TGT.stock = SRC.stock);
MERGE INTO dbo.StockHolding AS TGTUSING dbo.StockTrading AS SRCON TGT.stock = SRC.stockWHEN MATCHED AND (t.quantity + s.quantity = 0) THEN DELETEWHEN MATCHED THEN UPDATE SET t.LastTradeDate = s.TradeDate,
t.quantity += s.quantityWHEN NOT MATCHED THEN INSERT VALUES (s.Stock,s.TradeDate,s.Quantity)
Pre-SQL 2008 SQL 2008
Source Table(Stock
Trading)Target Table
(Stock Holding)
Merged Table(Stock
Holding)
INSERT
UPDATE
DELETE
A new user defined type - TableCan define indexes and constraints
Can be used for declaring table variablesInput parameters of Table type on SPs/Functions
Optimized to scale and perform better for large dataBehaves like BCP inside serverIn ADO.NET SqlDbType.Structured
CREATE TYPE myTableType AS TABLE (id INT, name NVARCHAR(100),qty INT);
Define multiple groupings in the same queryProduces a single result set that is equivalent to a UNION ALL of differently grouped rowsSQL 2006 standard compatiable
SELECT customerType,Null as TerritoryID,MAX(ModifiedDate)FROM Sales.Customer GROUP BY customerTypeUNION ALLSELECT Null as customerType,TerritoryID,MAX(ModifiedDate)FROM Sales.Customer GROUP BY TerritoryID order by TerritoryID
SELECT customerType,TerritoryID,MAX(ModifiedDate)FROM Sales.Customer GROUP BY GROUPING SETS ((customerType), (TerritoryID)) order by customerType
Offers full set of Open Geospatial Consortium components
Spatial
11
22334455
HierarchyID Store arbitrary hierarchies of data and efficiently query them
Large UDTs No more 8K limit on User Defined Types
Sparse Columns Optimized storage for sparsely populated columns
Wide Tables Support thousands of sparse columns
Filtered Indices Define indices over subsets of data in tables
11 33
44
55
22
// Create a Filtered Indexes
// Sparse columnCreate Table Products(Id int, Type nvarchar(16)…, Resolution int SPARSE, ZoomLength int SPARSE);
// Filtered IndicesCreate Index ZoomIdx on Products(ZoomLength) where Type = ‘Camera’;
// HierarchyID CREATE TABLE [dbo].[Folder]( [FolderNode] HIERARCHYID NOT NULL UNIQUE, [Level] AS [FolderNode].GetLevel() PERSISTED, [Description] NVARCHAR(50) NOT NULL);
// Create a Filtered Indexes
// Sparse columnCreate Table Products(Id int, Type nvarchar(16)…, Resolution int SPARSE, ZoomLength int SPARSE);
// Filtered IndicesCreate Index ZoomIdx on Products(ZoomLength) where Type = ‘Camera’;
// HierarchyID CREATE TABLE [dbo].[Folder]( [FolderNode] HIERARCHYID NOT NULL UNIQUE, [Level] AS [FolderNode].GetLevel() PERSISTED, [Description] NVARCHAR(50) NOT NULL);
Relational Semi Structured
What is it?Technique for working with relational tables as if they were objects in memoryIntention is to hide away the complexity of the underlying tables and give a uniform way of working with data
Why use it?ProductivityRetain database independence
Which ORM?There are many ORMs for .NET developers already in existence. E.g.
LLBLGen Pro http://www.llblgen.com/Nhibernate http://www.hibernate.org/343.htmlEntitySpaces http://www.entityspaces.net/Portal/Default.aspx
LINQ to SQL.NET Framework 3.5, Nov 2007Only SQL ServerSimpleEasy to learn and master
LINQ to Entities (ADO.NET Entity Framework)
.NET Framework 3.5 SP1, Aug 2008“Any” RDBMSComplexEasy to learn, hard to masterStrategic
HTTP (AtomPub)
Clients(Tools, Libraries, etc)
Clients(Tools, Libraries, etc)
SQL Data ServicesSQL Data ServicesSQL Data ServicesSQL Data ServicesADO.NET Data ADO.NET Data Services FrameworkServices Framework
ADO.NET Data ADO.NET Data Services FrameworkServices Framework
SQL Server
(On premises data service)
(Cloud data service)
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Data Data Access Access
LibLib
Data Data Access Access
LibLib
SDS SDS RuntimRuntim
ee
SDS SDS RuntimRuntim
ee
REST / REST / SOAPSOAP
REST / REST / SOAPSOAP
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Mgmt. Mgmt. ServicesServices
Mgmt. Mgmt. ServicesServices
DistribuDistributed ted
Data Data FabricFabric
DistribuDistributed ted
Data Data FabricFabric
SQL SQL ServerServer
SQL SQL ServerServer
Unit ofgeo-location and billingTied toDNS nameCollectionof Containers
Entity properties may differ in type and instance
Drop me an email if I confused you about anything!