Groups | Blog | Home
all groups > sql server programming > august 2003 >

sql server programming : ISNULL(MyTextColumn, '') returns error in View editor



Michael Carr
8/24/2003 9:59:38 PM
I have a column of TEXT data type named MyTextColumn. When I try to create a
view with this expression

ISNULL(MyTextColumn, '')

the View editor gives me an error that says, "Data type error in
expression." The same clause works perfectly in a stored procedure or in
Query Analyzer. I've also tried

ISNULL(MyTextColumn, CONVERT(text, ''))

but that doesn't work either.

Is this a known bug?

Thanks,
Michael Carr

oj
8/24/2003 11:09:42 PM
You want to use Query Analyzer for the view creation instead.

--
-oj
Rac v2.2 & QALite!
http://www.rac4sql.net


[quoted text, click to view]

Andrew John
8/25/2003 1:35:22 PM
Michael,

I can't duplicate this. Can you post the actual DDL code for the table and view
that have this problem, together with a row that errors?

This all works:

create table Txt
(
MyTextColumn text,
SomeOtherCol varchar(30)
)
go
insert Txt values ( null, 'ok' )
go
select ISNULL(MyTextColumn, 'Replaced')
from Txt

select coalesce( MyTextColumn, 'Replaced')
from Txt

create view MyTxt
as select ISNULL(MyTextColumn, 'Replaced') as TxtCol, SomeOtherCol
from Txt

select * from MyTxt

You may also want to try using coalesce instead - it's ANSI, and more flexible.

Regards
AJ


[quoted text, click to view]

AddThis Social Bookmark Button