SQL Server: 2008 to 2014: - datetime and time data types are incompatible in the add statement. Any other solution?

I am migrating from SQL Server 2008 to 2014 and I get an error

The datetime and time data types are incompatible in the add statement.

I calculated the conversion time of the solution into DateTime, but I have changes in many stored procedures and views.

Is there any other solution for this problem?

+4
source share
1 answer

, , SQL2014. , 2008 . .

ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = 100
GO
--DOESNOT WORK IN 2012 
DECLARE @ESTRecords TABLE
    (
     ESTime TIME(7) NOT NULL ,
     ESTDate DATE NOT NULL ,
     ESTDateTime AS ( CONVERT(DATETIME, ESTDate, ( 108 )) + ESTime )
       PERSISTED
    )

INSERT  INTO @ESTRecords
       ( ESTime, ESTDate )
VALUES  ( '12:00 PM', '12/31/2012' )

SELECT  *
FROM       @ESTRecords
+3

All Articles