We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


sql vbscript     if record null then

Medium Priority
Last Modified: 2008-01-09
I want to skip over a record if it is null so it does not print the section of the data

currently I have this which does not work

<% IF (NOT ISNULL (rs("OrgPhoneTTY"))) THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>

but it still prints the TTY if its empty
Watch Question

Top Expert 2006
Most likely it is not NULL but empty string. Try it this way ...

<% IF (NOT ISNULL (rs("OrgPhoneTTY"))) THEN %>
<% IF (TRIM(rs("OrgPhoneTTY")) <> "") THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>
<% end if %>

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Empty is different than null. Are you sure that rs("OrgPhoneTTY") is returning null and not just an empty string? What you can probably do is change it to this:

<% IF (NOT rs("OrgPhoneTTY") <> "" ) THEN %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% end if %>
Both previous expert comments could be correct.  if you go with amit's then you should do it all in 1 IF statement:

<% If Not isNull(rs("OrgPhoneTTY")) OR rs("OrgPhoneTTY")<>"" Then %>
<div>TTY  <%=rs("OrgPhoneTTY")%></div>
<% End If %>

~ MastaLlama ~
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.