Using LEFT on a TEXT-field in SQL Server
In a table, I 开发者_如何学Chave a text-field. I need to be able to select only the first 200 chars of the field - but LEFT does not work with TEXT-fields.
What to do?
instead of left . try with SUBSTRING
e.g : select SUBSTRING(TEXT,1,200) from dbo.tblText
You cannot apply string manipulation functions on TEXT fields - you should stop using TEXT anyway, since it will be removed from SQL Server soon!
What you can do is convert your TEXT column to VARCHAR(MAX) And then use the string gfunction:
SELECT LEFT(CAST(YourTextCol AS VARCHAR(MAX), 200) .....
精彩评论