Results 1 to 6 of 6

Thread: Simple SQL one

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230

    Question

    I want to to select all records from a table where a field is not null or is not a zero length string.

    SELECT * From tblTable Where fldFieldName = <<what goes here>>

    thanks
    Shawn Hull
    VB6, SP3 (Professional Edition)

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Posts
    126

    easy as pie :)

    select * from table where field <> "" or 0

    hope thats what you wanted...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Posts
    230
    Does the zero indicate a Null value?

    Shawn Hull
    VB6, SP3 (Professional Edition)

  4. #4
    Lively Member
    Join Date
    Sep 2000
    Posts
    126

    Post kinda

    if the field data type is integer then you use 0 for null, if its a text field you use two quotes, "".

  5. #5
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Worldwide in the Sun
    Posts
    566

    Re: kinda

    Originally posted by MasterGoon
    if the field data type is integer then you use 0 for null, if its a text field you use two quotes, "".
    NULL

    The Null value indicates that the variable contains
    no valid data.
    Null is not the same as Empty,whic indicates that a variable
    has not yet been initialized.
    It is also not the same as a zero-length string (""), which
    is sometimes referred to as a null string.

    Use the IssNull to determine wheter an expression contain
    a Null value.


    Cheers
    Ray
    Ray

  6. #6
    Junior Member
    Join Date
    Oct 2000
    Posts
    29

    Smile ANSWER...

    SELECT * From tblTable Where fldFieldName IS NULL
    OR fldFieldName = ''

    or use this...

    SELECT * From tblTable Where NOT fldFieldName IS NULL
    or fldFieldName = ''

    Hope, it helps... MAJA.
    VB and Java are great - ja, so ist es !! To my software programming site: http://www.majasoft-games.de .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width