图片字段类型的转换
— 假设你有一个名为YourTable的表,其中包含一个IMAGE类型的列名为ImageColumn
— 首先,你需要将IMAGE数据转换为VARBINARY类型,因为CONVERT函数不支持直接从IMAGE转换到VARCHAR
SELECT CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), ImageColumn), 2) AS ConvertedText
FROM YourTable;
SELECT * FROM tabDIYTable605 where isnull(CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), F6112), 2),”)<>”;图片需转换
SELECT * FROM tabDIYTable605 where F6111<>”;附件直接用空值
截取’\n’之前的字符窜
SELECT LEFT(your_column, CHARINDEX(‘\n’, your_column) – 1) AS trimmed_text
FROM your_table;
截取'{‘之后的字符窜
SELECT SUBSTRING(F6111, CHARINDEX(‘{‘,F6111)+1, LEN(F6111))
FROM tabDIYTable605
WHERE CHARINDEX(‘{‘,F6111) > 0;
截取回车换行符号之前的字符窜
SELECT LEFT(F6111, CHARINDEX(CHAR(13),F6111) – 1) AS trimmed_text
FROM tabDIYTable605 WHERE F6111<>”
截取回车换行符号之后的字符窜
SELECT SUBSTRING(F6111, CHARINDEX(CHAR(13),F6111)+1, LEN(F6111))
FROM tabDIYTable605
WHERE CHARINDEX(‘{‘,F6111) > 0;
附件字段转换成文件名
SELECT SUBSTRING(F6111, CHARINDEX(CHAR(13),F6111)+1, LEN(F6111))+LEFT(F6111, CHARINDEX(CHAR(13),F6111) – 1) AS trimmed_text
FROM tabDIYTable605 WHERE F6111<>”