检查图像列是否为空

检查图像列是否为空

本文介绍了检查图像列是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个Image列,想要检查它在StoredProc中是否为空.我也尝试过这样,如果(@ Imag = Null),但显示错误,例如
无法比较或排序text,ntext和image数据类型.请使用示例

hi all,

i''ve a Image column and wanted to check whether it is empty in StoredProc.And i also tried like this,if(@Imag=Null),but showing error like
The text, ntext, and image data types cannot be compared or sorted.please reply with an example

推荐答案

select DataLength(column1) from table1



请参见此处 [ ^ ]



see here[^]


DECLARE @Img varchar(50)
SET @Img = (SELECT ImageName FROM MyTable WHERE Id=1)

IF @Img IS NULL
    BEGIN
        PRINT 'Image is NULL'
    END
ELSE IF LEN(@Img) < 0
    BEGIN
        PRINT 'Image is blank'
    END
ELSE
    BEGIN
        PRINT 'Image is available = ' + @Img
    END



希望对您有所帮助.



Hope it helps.


Declare int column_length;
declare curs cursor for select Length(image) from user_table where user_name ="XXX";

open curs
fetch curs into column_length
close curs


希望这会有所帮助...


Hope this will help...


这篇关于检查图像列是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 17:20