Home Forums SQL Server 7,2000 Globalization How can I check if and xml Field is not null or blank in sql sever RE: How can I check if and xml Field is not null or blank in sql sever

  • create table #T (

    ID int identity primary key,

    XMLCol XML);

    insert into #T (XMLCol)

    select ' ';

    insert into #T (XMLCol)

    select '';

    insert into #T

    default values;

    select *

    from #T

    where XMLCol is not null and cast(XMLCol as varchar(max)) != '';

    That seems to work. Try it on yours.

    Of course, using a cast function like that in the Where clause will slow the query down, but at least it will get the job done.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon