Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pull only populated records into ASP page 1

Status
Not open for further replies.

ecugrad

MIS
Apr 17, 2001
191
US
I have a comment field (ntext) that I only want to display the record if something is populated in it. At the present time I have a bunch of empty boxes when I loop and it does'nt look to appealing. Question: How do I pull only the records that have something populated in them from a text field.


Thanks,
Mike
 
Since you mentioned ntext, can I assume that you are using a Microsoft SQL Server database? If so, what version.

If you are using SQL Server 2005 or SQL Server 2008, then I would recommend you change the data type of the column to nvarchar(max) This data type allows you to store the same amount of data as nText, but it also allows the normal string handling functions to work, too.

If you are using SQL2000, then you could modify your query to include a where clause, like this...

[tt][blue]
Where DataLength(YourNTextColumn) > 0
[/blue][/tt]

If you do change the data type, then you could use this where clause instead:

[tt][blue]
Where YourNVarCharMaxColumn > ''
[/blue][/tt]



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top