I have a table where some of the columns have the value 'NULL' instead of null values so my query below fails and I need a way to fix the query, I have limited control on data:
select * from temp where
FY1= (YEAR(DATEADD(month, 6 + DATEDIFF(month, 0, getdate()), 0)))
here the 3145 has the FY1 value as 'NUll' where as others have the value either like 2013 or null and the column is varchar(4)
all I am doing is bring in data which matched this fiscal year
and with the above query I am getting the error :
Conversion failed when converting the varchar value 'NULL' to data type int.
where as the same works for null values