NOT LIKE Command?

Posted on 2006-06-07
Last Modified: 2012-06-27
Is there a NOT LIKE command for SQL? I'm trying to do a report on our ISA server log but I don't want to see anything for When I do a comamnd like this

SELECT DISTINCT ClientUserName, logTime, DestHost
FROM         dbo.[Test Lab]
WHERE     (DestHost LIKE '') OR
                      (DestHost LIKE '')

I get only the weatherbug items. When I throw a NOT in front of LIKEI still get the weather bug Items. Any ideas?
Question by:t1clausen
    1 Comment
    LVL 142

    Accepted Solution

    to negate, you have ALSO to negate the OR, hence put a AND:

    SELECT DISTINCT ClientUserName, logTime, DestHost
    FROM         dbo.[Test Lab]
    WHERE     (DestHost NOT LIKE '') AND
                          (DestHost NOT LIKE '')

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now