Mark Johnston Development Lead - MSDN Microsoft Corporation TL42.

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Taylor Brown Test Lead Microsoft Corporation ES09.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Douglas K. Olson General Manager Microsoft Corporation  Pete Blois Lead Program Manager Microsoft Corporation PC47.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
 Phil Haack Senior Program Manager Microsoft Corporation PC21.
 Nishant Gupta Program Manager Live Services Microsoft Corporation BB51.
Co- location Mass Market Managed Hosting ISV Hosting.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
 Pablo Castro Software Architect Microsoft Corporation TL08.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Session 1.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
 Frank Savage Architect Microsoft Corporation.
 Bertrand Le Roy Senior Program Manager Lead Microsoft Corporation PC32.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Chaitanya Sareen Senior Program Manager Microsoft Corporation PC24.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Connect with life Connect with life
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
 Paul Vick Principal Architect Microsoft Corporation  Lucian Wischik Software Engineer Microsoft Corporation.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
SQL Server SQL Azure Visual Studio“Quadrant” SQL Server Modeling Services Entity Framework ADO.NET“M”/EDM Data Services …
Ian Ellison-Taylor General Manager Microsoft Corporation PC27.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
Feature: Void Historical/Open Transaction Updates © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
 Boris Jabes Program Manager Lead Microsoft Corporation TL13.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

IoCompleteRequest (Irp);... p = NULL; …f(p);
MIX 09 4/17/2018 4:41 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
Title of Presentation 12/2/2018 3:48 PM
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows 8 Security Internals
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
5/1/2019 3:29 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
Title of Presentation 7/24/2019 8:53 PM
Presentation transcript:

Mark Johnston Development Lead - MSDN Microsoft Corporation TL42

Subscriptions MSDN Web Sites MSDN Magazine Offline Help This talk is only about this part of MSDN

Content Providers Online Services MSDN

Content Providers Visual Studio SQL Server Exchange Office Windows KB Articles … SQL Servers IIS/Web Datacenter 1 Datacenter 2 Transactional Replication All Content is Stored in SQL Server

MERGE employee as target USING employee_changes as src ON src.loginid = target.loginid WHEN MATCHED THEN /* UPDATE */ UPDATE SET first = src.first,last = src.last WHEN NOT MATCHED THEN /* INSERT */ INSERT (loginid,first,last) VALUES(src.loginid,src.first,src.last) WHEN NOT MATCHED BY SOURCE THEN DELETE; /* DELETE */

Employee_changes “source” table Applied to loginidfirstlastage JohnAJohnAdams32 SteveCSteveCox25 BillSBillSmith51 loginIdfirstlastage JohnAJohnAdams31 SteveCSteveCox25 BobMBobMartin48 INSERT DELETE loginidfirstlastage JohnAJohnAdams32 SteveCSteveCox25 BillSBillSmith51 BobMBobMartin48 Employee “Target” result after MERGE UPDATE untouched This process is known as Delta Processing Employee “Target“ Table

Mark Johnston Development Lead - MSDN Microsoft Corporation

Mark Johnston Development Lead - MSDN Microsoft Corporation

Source loginidtypephoneNum JohnAcell JohnAhome JohnAWork Target loginidtypephoneNum JohnAcell JohnAhome SteveChome SteveCcell Need to fix the ON clause of the MERGE statement Problem #1: Error: target row matches more than one source row

SourceTarget Need to properly define the scope of the target UPDATE untouched INSERT DELETE Problem #2: Inadvertent rows are being deleted loginidtypephoneNum JohnAcell JohnAhome JohnAWork loginidtypephoneNum JohnAcell JohnAhome JohnAWork SteveChome SteveCcell

;WITH target AS (SELECT ep.* FROM EmployeePhone AS ep JOIN (SELECT distinct loginId from #t) t ON t.loginId = ep.loginId) MERGE target USING (SELECT * FROM #t) AS SRC ON SRC.loginid = target.loginid AND SRC.Type = target.type WHEN MATCHED AND (target.phoneNum <> SRC.phoneNum) THEN UPDATE SET target.phoneNum=SRC.phoneNum WHEN NOT MATCHED THEN INSERT (loginid, type, phoneNum) VALUES (SRC.loginid, SRC.type, SRC.phoneNum) WHEN NOT MATCHED BY SOURCE THEN DELETE; Untouched

InsertDelete Update Subset Insert Update SourceTarget Delete Subset

Mark Johnston Development Lead - MSDN Microsoft Corporation

dbo.EmployeeTableType insert values (N’JohnA’,N’John’, N’Adams’) dbo.EmployeePhoneTableType insert values (N’JohnA’,N’cell’, N’ ’) insert values (N’JohnA’,N’home’, N’ ’) insert values (N’JohnA’,N’work’, N’ ’) exec dbo.mergeEmployeeAndPhoneWithTVP

exec contentInsertUpdate … /*if update content then delete rows in related tables associated with content */ exec contentPrimaryDocInsert … … exec contentImageInsert … … exec contentMetaDataInsert … … /* there are 10 content related tables */

exec /* contentTableType /* primaryDocTableType /* imageTableType /* metaDataTableType */ … /* All data related to the content is passed into one stored procedure */

Mark Johnston Development Lead - MSDN Microsoft Corporation

EmployeeInsert EmployeeUpdate EmployeeDelete Employee EmployeePhoneInsert EmployeePhoneUpdate EmployeePhoneDelete EmployeePhone

EmployeeMerge Employee EmployeePhoneMerge EmployeePhone

EmployeeMerge Employee EmployeePhone EmployeeAddress

contentMerge content contentPrimaryDoc contentMetaData contentImage exec /* contentTableType /* primaryDocTableType /* imageTableType /* metaDataTableType */ …

Mark Johnston Development Lead – MSDN Microsoft Corporation

Please fill out your evaluation for this session at: This session will be available as a recording at:

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Mark Johnston Development Lead – MSDN Microsoft Corporation

IF exists (select * from Product where productNumber = ‘AR-5381’) BEGIN update product set … where productNumber = ‘AR-5381’ END ELSE BEGIN INSERT product (…) SELECT ‘AR-5381’, … END Race condition