Test if a ntext field id empty in a select query
Posted on 2011-10-28
I have this table of Hotels:
ID, HOTELNAME, DESCRIPTION
The field description is NTEXT and contains many text related to the Hotel.
I want to show a list of all the hotel with a link to a description page, if it is not empty.
The stupidest way to do it I imagine is:
SELECT ID, HOTELNAME, DESCRIPTION from HOTEL
IF DESCRIPTION <> "" ==> link to description page
But is a very brutal query ... I have to select all the text inserted in a NTEXT field slowing a lot the query.
Is there a way to test if DESCRIPTION is empty or NULL without to select the whole text contained in it in the query?
Something like this:
select ID, HOTELNAME, if description not null or not "" ==> it_has_description = yes