Your SlideShare is downloading. ×
Using New Data Types In2008
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Using New Data Types In2008

1,599
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,599
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Using New Data Types in 2008 Andrew Couch UK Access User Group www.ukaug.co.uk ASC associates www.upsizing.co.uk
  • 2. Flow of Presentation
    • Data types and products
    • Share Point : Access & SQL Server
    • SQL Server : Access & Visual Studio
    • SQL Server New Data Types
    • Updating Data & Multi-user Issues
    • Summary
  • 3. Why are we interested in Data Types?
    • What we do with data
      • Exchange
        • Converting and exchanging data between products
      • Applications that present data
        • Linking applications to back-end data sources
      • Applications that maintain data
        • updating data with applications linked to back-end data source
  • 4. Which Products will we consider?
    • Products
      • Access
        • Application and data source
      • SQL Server
        • data source and application components, also report services
      • Share Point
        • Application and data source (SQL Server)
      • Visual Studio
        • Application
  • 5. What Data Types do the Products support? Access (2007) GUID Multi-value fields Share Point (2003) see next slide SQL Server (2008) Visual Studio (2005/8) n prefix for Unicode
  • 6. Share Point (2003)
  • 7. Share Point under the hood Data is held in the AllUserData table which has a generic set of fields, nvarchar1,nvarchar2......Text1,Text2.........
  • 8. Access to Share Point Data Types; MOSS
  • 9. Access (2007) & Share Point
    • Attachments (share point lists)
    • Multi-value fields (share point lists)
  • 10. Share Point a Data/Object Model; WSS
    • Object Model Enhancements for Visual Studio
      • http://msdn2.microsoft.com/en-us/library/ms480101.aspx
    • Ethan’s blog, Inspecting The SharePoint Content Database
      • http://www.sharepointblogs.com/ethan/archive/2007/09/16/inspecting-the-sharepoint-content-database.aspx
    • Architectural Overview of Windows SharePoint Services
      • http://msdn.microsoft.com/en-us/library/ms916813.aspx
  • 11. Access to SQL Server Data Type Mappings
    • Yes/No (boolean) : bit
      • Access True -1, SQL Server True 1; also SQL Server boolean is tri-state 0, 1 and NULL
    • Text : varchar or nvarchar or char or nchar
    • Date/Time : datetime
    • Currency : money
    • Autonumber : int (identity property)
    • OLE Object : image, varbinary, filestream
    • Memo : text or varchar(max)
    • Number : various mappings
  • 12. Access Yes/No Data
  • 13. Yes/No (without a default) Translated To SQL Server
  • 14. Access Memo and OLE Data Types
  • 15. Access Using SQL Server 2000 IMAGE and TEXT Data Types
  • 16. Visual Studio Editing Records in DetailsView; issues with Text Data Type
  • 17. Visual Studio and Image/OLE Data issues with Image Data Type
  • 18. Access & SQL Server 2005 Varchar(max) and Varbinary(max)
  • 19. Visual Studio DetailsView now works for Updates when using Varchar(max)
  • 20. Visual Studio, Images and OLE still a problem with Varbinary(max) some people would suggest that image data should not directly held in the database and instead a text link is used to point to an external image file which works around this issue
  • 21. Mini-summary
    • Access to SQL Server
      • MEMO to VARCHAR(max) or TEXT
      • OLE to IMAGE or VARBINARY(max), FILESTREAM ?
    • Visual Studio
      • VARCHAR(max) a better choice
      • OLE/IMAGE data doesn’t work for bound controls
  • 22. SQL Server (2005)
    • XML data type
      • office requires program code using new SQL Native Client drivers to manipulate this
    • varchar(max), nvarchar(max)
      • advantages for programmers as can use as a variable (not possible with older text data type)
    • varbinary(max)
  • 23. Date & Time Data
    • IBM DB2
      • DATE, TIME and TIMESTAMP date range 0001-01-01 to 9999-12-31
    • Oracle
      • DATE (includes time), TIMESTAMP, date range January 1 4713 BC to 9999-12-31
    • SQL Server (2000/2005)
      • DATETIME, SMALLDATETIME, date range 1753-01-01 to 9999-12-31 for DATETIME, when no date given defaults to 1st January 1900
    • Access – DATE/TIME
      • date range 1-1-100 to 9999-12-31,when no date given defaults to 30th December 1899 and hides date
    • SQL Server (2008)
      • DATE, TIME,DATETIME2, DATETIMEOFFSET range 0001-01-01 00:00:00:0000000 to 9999-12-31 23:59:59:9999999
  • 24. Access allowing Updates to new Date and Time Data Types
  • 25. Searching
    • some limitations where fields are strings
  • 26. Controlling Time Precision
  • 27. SQL Server (2008)
    • Filestream
      • Unstructured large object data
    • DATE and TIME
      • Dates from 01/01/0001 to 31/12/9999
      • Times accurate to 00:00:00:0000000
    • DATETIME2 and DATEOFFSET
      • New combined date and time data types with higher accuracy, Combines above, offset type includes time-zone data
    • HIERARCHYID
      • Optimised for data hierarchies (special functions)
    • GEOGRAPHY and GEOMETRY
      • .NET-based spatial data
      • First deals with round-earth co-ordinates, second uses a flat-earth style of co-ordinates
      • Special functions
  • 28. Geography
    • It comes as no surprise that this renders in a binary type format and you can’t edit it
    • Stored procedures and pass through queries to the rescue!
  • 29. With a little Magic
  • 30. Geography Methods
  • 31. Timestamps & Multiple Users
    • SQL
    • Server
    Overwrite data when changed Optimistic row versioning Timestamp checking Visual Studio does not utilise timestamps on bound controls the new LINQ will support timestamp concurrency
  • 32. Access Row Versioning & Timestamps Row Versioning SQLExecDirect: UPDATE "dbo"."authors" SET "au_fname"=? WHERE "au_id" = ? AND "au_lname" = ? AND "au_fname" = ? AND "phone" = ? AND "address" = ? AND "city" = ? AND "state" = ? AND "zip" = ? AND "contract" = ? Timestamps SQLExecDirect: UPDATE "dbo"."authors" SET "au_fname"=? WHERE "au_id" = ? AND "ts" = ? Timestamps improve efficiency and remove potential problems with rounding errors in numerical data
  • 33. LINQ
    • Visual Studio 2005 bound controls don’t support timestamp checking
    • Walkthrough: Using a Timestamp with the LinqDataSource Control to Check Data Integrity
      • http://msdn.microsoft.com/en-us/library/bb470449.aspx
    • Walkthrough: Selecting and Filtering a Subset of Data with the LinqDataSource and GridView Controls
      • http://msdn.microsoft.com/en-us/library/bb470363.aspx
  • 34. Visual Studio, write-back failure with null values
    • If @original_CompanyName is null and new value is null then the write-back will fail when NULL=NULL (UNKNOWN)
    • For further information see http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=93937
    UpdateCommand = "UPDATE [Customers] SET [CompanyName] = @CompanyName…… WHERE [CustomerID] = @original_CustomerID AND [CompanyName] = @original_CompanyName”
  • 35. Example Visual Studio Update handling Null Values UpdateCommand = "UPDATE [Customers] SET [CompanyName] = @CompanyName WHERE [CustomerID] = @original_CustomerID COALESCE([CompanyName],'') = COALESCE(@original_ CompanyName,'')” For numerics use COALESCE([fieldname],0) For dates use COALESCE([fieldname],’ 1st January 1900’ ) Or ([CompanyName] = @original_CompanyName ) OR ([CompanyName] IS NULL and @original_CompanyName IS NULL) Or use SET ANSI_NULLS OFF
  • 36. tsequal function
    • Time stamps can not be directly compared by a program, although SQL Server has a function called tsequal which can perform a comparison in a stored procedure.
    • WHERE tsequal(@ts1,@ts2)
  • 37. Summary
    • We have a diverse set of data types in the different products
    • Need to test data types for product compatibility, don’t forget different versions and drivers can have an impact
    • Access and Share Point very good compatibility
    • Access and SQL Server good compatibility
    • Share Point data easily exported and linked MOSS but WSS more difficult
    • SQL Server 2008 new data types hold great promise, and it will possible work with then in Office 2007
  • 38. Wish list
    • tree presentation for XML data when linking Office to SQL Server
    • Visual Studio bound controls to display bound image data
    • Visual Studio bound controls to support timestamps
  • 39. ASC Associates
    • Software consultancy specialising in Access, SQL Server and .net applications
    • Migration Upsizing SQL Tool
      • MUST
        • upsizes Access databases to SQL Server 2000/2005/Express
      • MUST+SQL
        • converts Access queries to views and stored procedures in SQL Server 2000/2005/Express
      • MUST+Web
        • converts Access forms to web forms in Visual Studio projects in SQL Server 2005/Express
    • www.upsizing.co.uk
    • [email_address]