Blank Data

  • Hello

    I want to extract a marketing data from a database and there is a certian field that has blank records instead of NULL.

    Does any one know how I can extract the records of those with blank fields in a particular column? I have tried the IS NULL keyword within the WHERE clause but it doesnt work.

  • WHERE Field = ''

    If you have multiple spaces then something like LTRIM(Field) = '' OR LEN(Field) = 0 (this is not performance friendly on large datasets depending on the data selectivity)

  • Thanks

    Your a star!!!

  • What will i have to write to extract records that are not blank?

  • Where Field = '' returns all rows that have empty string.

    Where Field <> '' Returns all rows that are not empty strings.

    Where Field != '' same as above.

    Where Field IS NULL returns rows with a value of NULL (don't use Field = NULL)

    Where Field IS NOT NULL returns rows that are not NULL (includes empty strings)

    Where ISNULL(Field, '') = '' Returns rows that are null or empty string

    Where ISNULL(Field, '') != '' Returns rows that are not empty strings and not null

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply