Link to home
Create AccountLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

T-SQL: problem comparing datetime

I want to include records from the last one year but have trouble casting the date...

WHERE Cast(sfl.[DateOfException] as date) > DATEDIFF(year, -1, GETDATE())

What is wrong with this syntax?

I get "Operand type clash: date is incompatible with int"

Thankls
ASKER CERTIFIED SOLUTION
Avatar of Nakul Vachhrajani
Nakul Vachhrajani
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of curiouswebster

ASKER

thanks