Date and Time Data Type Size (bytes) Example Notes Client Providers DATE 3 '2009-10-01' OLEDB: DBTYPE_DBDATE TIME 3-5 '13:12:00.1234567' Accurate to 100 nanoseconds OLEDB: DBTYPE_DBTIME DATETIME2 6-8 '2009-10-01 13:12:00.1234567' Accurate to 100 nanoseconds OLEDB: DBTYPE_DBTIMESTAMP DATETIMEOFFSET 8-10 '2009-10-01 13:12:00.1234567+02:00' Accurate to 100 nanoseconds OLEDB: DBTYPE_DBTIMESTAMP There are a number of new functions which can also be used with these new datatypes including: Other Data Type Size (bytes) Useage Returns Notes HIERARCHYID VARBINARY DECLARE @h hierarchyid = hierarchyid::GetRoot() DECLARE @c hierarchyid '/1/' Represents position in a hierarchy Actually a CLR function with several methods eg
ADO.Net: DateTime
ODBC: SQL_DATE
ADO.Net: TimeSpan
ODBC: SQL_TIME
Can specify precision ie decimal places eg DATETIME(3)
ADO.Net: DateTime
ODBC: SQL_TIMESTAMP
ADO.Net: DateTime
ODBC: SQL_TIMESTAMP
eg 5 bytes for 100k records at 6-LevelsSET @c = @h.GetDescendant(NULL, NULL)
SELECT @c.ToString()
Tuesday 28 October 2008
What’s New in SQL 2008 – Part 2 – Data Types
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment