SQL: Why does 'S%' Die?

Discussion in 'C#' started by circuscircus, Jun 12, 2007.

Thread Status:
Not open for further replies.
  1. #1
    For some reason ANY any alphabet works EXCEPT S

    select * from tContact where UPPER(LASTNAME) LIKE 'A%' AND CONTACTSTATUSID = 1 ORDER BY LASTNAME ASC, FIRSTNAME ASC
    Code (markup):
    ^above works but once you put S in there, it dies

    (Does not work)
    select * from tContact where UPPER(LASTNAME) LIKE 'S%' AND CONTACTSTATUSID = 1 ORDER BY LASTNAME ASC, FIRSTNAME ASC
    Code (markup):
    Why is that? Is there a work-around?
     
    circuscircus, Jun 12, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    like is not case senstitve, also, never do Select *

    Do:

    SELECT tContact.FieldName1, tContact.Fieldname2
    FROM tContact
    WHERE (LastName Like 'S%') AND (ContactStatusID = 1)
    ORDER BY LastName, FirstName
     
    ccoonen, Jun 12, 2007 IP
Thread Status:
Not open for further replies.