datetime2

Using SQL Server 2008 and SQL Server 2005 and date time

I've built a entity framework model against a 2008 database. All works ok against the 2008 database. When I try to update the entity on a 2005 database I get this error. The version of SQL Server in use does not support datatype 'datetime2 I specifically did not use any 2008 features when I built the database. I can't find any ref...

SSIS 2008 Execute SQL output parameter mapping datetime2 problem

Hi, I'm trying to use an Execute SQL Task in SSIS 2008 to map a store procedure output parameter to a package variable. The package variable is SSIS type DateTime and the store procedure parameter is SQL type DATETIME. The SQL Statement is EXEC GetCurrentDate @CurrentDate=? and in the parameter mapping screen, the parameter is mapped t...

T-SQL: Convert datatime2 to datetime for all columns of type datetime2

I've got a database full of datetime2 columns than needs to be moved to a SQL 2005 database. So, I need to convert all these datetime2(7) columns to datetime. How can I go about doing this? Right now I've managed to select the table name and column name for all columns with the datetime2 datatype like this: SELECT t.name, c.name, i.DA...

How to force LINQ to SQL to pass .NET DateTime as datetime2?

I have a simple query in LINQ to SQL: var id = 23479824; var date = Changes.Where(ch => ch.Id == id).First().Date; var diff = Changes.Where(ch => ch.Id == id).Select(ch => SqlMethods.DateDiffNanosecond(date, ch.Date)).First(); The diff variable should be zero, however is not. The generated SQL is following: DECLARE @p0 DateTime = '20...

Unexpected error about DateTime type

Hi everyone, I have a .aspx page for adding new product include the following field: ID, Name, DateTime, Price and it run well at localhost but when I publish it and up to the server, then I get the following error: System.Data.UpdateException: An error occurred while updating the entries. See the InnerException for details. ---> Sy...