0
votes

Error is : SQL compilation error: error line 1 at position 8 Invalid argument types for function 'DATE_DIFFDATEINYEARS': (NUMBER(1,0), DATE)

SQL i wrote : Select DATEDIFF (YEAR,0, CURRENT_DATE())

2

2 Answers

4
votes

The second argument (parameter) into the function should be a date (or timestamp) as well as the third.

https://docs.snowflake.net/manuals/sql-reference/functions/datediff.html

example as follows:

select datediff(year, current_date(), current_date());
1
votes

Please use below code:

select DATEDIFF(year, '1900-01-01', CURRENT_TIMESTAMP())