3

Microsoft did introduce the Datetime2 type in SQL server 2008.

However, even with VS 2010 (made by the same compagny and realeased 2 years after MSSQL2008), I couldn't find a variable type that would handle Datetime2 with full precision.

Is there any variable type that would allow me to handle Datatime2 in .NET without any precision lost?

If the answer is no, do you know if Microsoft have any plan about creating such type in a near future?

The_Black_Smurf
  • 5,178
  • 14
  • 52
  • 78
  • 3
    Ahem.... as far as I know, the .NET `DATETIME` structure **always** had that precision - it tooks Microsoft 8 or 9 years after introduction of .NET to have the same thing in SQL Server..... – marc_s Jan 12 '11 at 13:48

1 Answers1

1

Take a look at the MSDN Page for Mapping CLR Parameter Data. According to MSDN, your best bet for mapping Datetime2 is using DateTime or Nullable<DateTime>.

If neither of those meet your requirements, then I'm guessing the answer would be no and I don't think Microsoft would be releasing anything in the near future.

Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
  • I think you are right. I guess my only option would be to create a custom class and use strings to create a SQL statement in order to read / write into the database. – The_Black_Smurf Jan 24 '11 at 11:47