Thursday, March 22, 2012

Check if image column is empty

Currently I use the follow Select statement to test if a non-nullable image
column is empty and not null:
Select Case When Substring(ImageColumn,1,1)='' Then 1 Else 0 End As IsEmpty
Can any body show me a better way to check if a column (non-nullable column)
of image data type is empty.DataLength(ColName) will be zero (0) if it's empty...
"krygim" wrote:

> Currently I use the follow Select statement to test if a non-nullable imag
e
> column is empty and not null:
> Select Case When Substring(ImageColumn,1,1)='' Then 1 Else 0 End As IsEmpt
y
> Can any body show me a better way to check if a column (non-nullable colum
n)
> of image data type is empty.
>
>|||Or, actually, just check if the column's value itself = '' (empty string)...
That should work. you don't need to attempt to extract the first character
and test that...
"krygim" wrote:

> Currently I use the follow Select statement to test if a non-nullable imag
e
> column is empty and not null:
> Select Case When Substring(ImageColumn,1,1)='' Then 1 Else 0 End As IsEmpt
y
> Can any body show me a better way to check if a column (non-nullable colum
n)
> of image data type is empty.
>
>|||Thanks
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:380D392D-B82A-493E-AA22-C137F4599577@.microsoft.com...
> DataLength(ColName) will be zero (0) if it's empty...
> "krygim" wrote:
>
image
IsEmpty
column)|||I got the error message: "The text, ntext, and image data types cannot be
compared or sorted."
"CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
news:3ADDA38D-0AC0-4377-9933-182222F35875@.microsoft.com...
> Or, actually, just check if the column's value itself = '' (empty
string)...
> That should work. you don't need to attempt to extract the first
character
> and test that...
>
> "krygim" wrote:
>
image
IsEmpty
column)|||Yes, you're right, DataLength() is the only other way...
"krygim" wrote:

> I got the error message: "The text, ntext, and image data types cannot be
> compared or sorted."
>
> "CBretana" <cbretana@.areteIndNOSPAM.com> wrote in message
> news:3ADDA38D-0AC0-4377-9933-182222F35875@.microsoft.com...
> string)...
> character
> image
> IsEmpty
> column)
>
>

No comments:

Post a Comment