WHERE clause on SQL Server “Text” data type

前端 未结 7 2514
不思量自难忘°
不思量自难忘° 2020-11-28 09:52

Where [CastleType] is set as data type \"text\" in SQL Server and the query is:

SELECT *
FROM   [Village]
WHERE  [CastleType] = \'foo\' 

I

7条回答
  •  孤街浪徒
    2020-11-28 10:00

    If you can't change the datatype on the table itself to use varchar(max), then change your query to this:

    SELECT *
    FROM   [Village]
    WHERE  CONVERT(VARCHAR(MAX), [CastleType]) = 'foo'
    

提交回复
热议问题