检查图像列是否为空 [英] Check if image column is empty

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

问题描述

大家好,

我有一个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

推荐答案

进行答复,检查image列是否为空,则DataLength()将为零
check if image column is null then DataLength() will be zero
select DataLength(column1) from table1



请参见此处 [



see here[^]


尝试一下以更好地理解.

Try out this for better understanding.

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.


尝试一下...
Try this...
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...


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆