Results 1 to 3 of 3

Thread: Help... Question about SQL Server

  1. #1

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Post

    Dear All...

    I have a simple question...
    I want to make a query like below :

    Select * from trans_stock where pack_no = ''

    (I want to select all field from trans_stock table where pack_no is empty / NULL).

    But the problem is after I ran it, the result has failed.
    Actually, if my query runs well, it will result 3 records...
    But, after i run my SQL statement above, it shows that the result is 0 Record...

    My question is, how can i select all fields from trans_stock table where pack_no is empty or NULL ???

    Thx...

    Wen Lie

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229

    Post


    Hi Wen Lie,

    Select * from trans_stock where
    (pack_no = '') or (pack_no is null)

    in case pack_no contains space(s), you may do this ....

    Select * from trans_stock where
    (ltrim(rtrim(pack_no)) = '') or
    (pack_no is null)

    Does it help ?

    Regards


  3. #3

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Post

    Thx...
    It helpssss........

    Wen Lie

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