sql - TSQL: Arithmetic overflow error converting expression to data type datetime -



sql - TSQL: Arithmetic overflow error converting expression to data type datetime -

i trying run simple query sum of amounts lastly year , getting error. can shed lite on please. not doing casting , tx_date column of type date.

select sum(amount) total transactions id = '12345' , type = 'amount' , datediff(month,tx_date,getdate()) <= 12

error:

caused by: com.microsoft.sqlserver.jdbc.sqlserverexception: arithmetic overflow error converting look info type datetime. @ com.microsoft.sqlserver.jdbc.sqlserverexception.makefromdatabaseerror(sqlserverexception.java:216) @ com.microsoft.sqlserver.jdbc.sqlserverresultset$fetchbuffer.nextrow(sqlserverresultset.java:4853) @ com.microsoft.sqlserver.jdbc.sqlserverresultset.fetchbuffernext(sqlserverresultset.java:1781) @ com.microsoft.sqlserver.jdbc.sqlserverresultset.next(sqlserverresultset.java:1034) @ org.apache.commons.dbcp.delegatingresultset.next(delegatingresultset.java:207) @ org.apache.commons.dbcp.delegatingresultset.next(delegatingresultset.java:207) @ org.springframework.jdbc.core.rowmapperresultsetextractor.extractdata(rowmapperresultsetextractor.java:91) @ org.springframework.jdbc.core.rowmapperresultsetextractor.extractdata(rowmapperresultsetextractor.java:1) @ org.springframework.jdbc.core.jdbctemplate$1querystatementcallback.doinstatement(jdbctemplate.java:446) @ org.springframework.jdbc.core.jdbctemplate.execute(jdbctemplate.java:396) ... 50 more

check type of tx_date. seems not date.

sql tsql jdbc

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -