Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    53

    Unanswered: returning part of recordset

    Hi, I have a table that has the following field and results.

    I want a where clause that returns records that start 0000........

    I need to exclude those records that start 0001..........

    Can anyone help

    oseq
    -------
    0000
    0000.0000
    0000.0000.0000
    0000.0000.0000.0000
    0000.0000.0000.0000.0000
    0000.0000.0000.0000.0001
    0000.0000.0000.0001
    0000.0000.0001
    0001
    0001.0000
    0001.0001
    0001.0002
    0000.0000.0002
    0000.0000.0003
    0000.0001
    0000.0001.0000
    0000.0001.0000.0000
    0000.0001.0000.0000.0000
    0000.0001.0000.0000.0000.0000
    0000.0026.0004.0009
    0000.0026.0004.0010

  2. #2
    Join Date
    Jan 2004
    Location
    In a large office with bad lighting
    Posts
    1,040

    Post

    You could use either the substring function or the like operator. Check BOL for more detail.

    Tom

  3. #3
    Join Date
    Feb 2002
    Location
    Assam, India
    Posts
    55

    Smile

    Try like this

    select * from test
    where oseq like '0000%'


    Roshmi Choudhury

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Roshmi's answer is simpler, and potentially much more efficient because it allows the query to use an index.

    -PatP

Posting Permissions

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