I need to convert an NTEXT
column to an INT
so I can perform some checks on it.
The first check would be is value = 0
, and the second would be if it was an even or an odd number. I've got this mostly figured out except the conversion of the NTEXT
to INT
. So far what I have is this:
cast((cast(a.[Value1] as nvarchar(max))) as int) = 0
The column data looks like this '0'
. When I run my query I get:
Conversion failed when converting the nvarchar value ''0'' to data type int.
What are my options to get around this; is there a way to make it ignore the quotation marks?
ntext
? Wholly inappropriate datatype.ntext
is (a) deprecated (b) Was intended for large strings > 8KB (c) is double byte as it is for storing strings containing more exotic characters than just numbers.