What's the right way to compare an NTEXT column with a constant value?

后端 未结 2 561
予麋鹿
予麋鹿 2020-12-24 11:17

If I use something like

[ntext2] <> \'1,032.5\',

I get this error:

The data types ntext and varchar are incomp

2条回答
  •  悲&欢浪女
    2020-12-24 12:14

    If you would prefer not to cast, you can get by in some scenarios using LIKE or PATINDEX, as demonstrated on this MSDN thread: http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/6bd4c661-ea0b-435f-af78-097e61549d41

    The LIKE expression, without wildcards, would be (in this case) roughly equivalent to a test for equality.

    In this case, the expression would be:

    [ntext2] NOT LIKE '1,032.5'
    

提交回复
热议问题