sql select question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Starbuck

    #1

    sql select question

    Hi

    The sql command below does not seem to work in SQL Server, can someone show
    where I am going wrong

    Select * from users where ref like '*JOH*' order by ref

    Thanks in advance

    --

    Kevin Martin
    Motor Trade Technologies


  • Kerry Moorman

    #2
    RE: sql select question

    Starbuck,

    The wildcard character should be %, not *.

    Kerry Moorman


    "Starbuck" wrote:
    [color=blue]
    > Hi
    >
    > The sql command below does not seem to work in SQL Server, can someone show
    > where I am going wrong
    >
    > Select * from users where ref like '*JOH*' order by ref
    >
    > Thanks in advance
    >
    > --
    >
    > Kevin Martin
    > Motor Trade Technologies
    >
    >
    >[/color]

    Comment

    • Jim Underwood

      #3
      Re: sql select question

      replace the * with % and you should be all set. I think the * is only for
      microsoft access.


      "Starbuck" <Starbuck@tisco ni.com> wrote in message
      news:DUq9f.1980 2$Ce5.4413@news fe1-gui.ntli.net...[color=blue]
      > Hi
      >
      > The sql command below does not seem to work in SQL Server, can someone[/color]
      show[color=blue]
      > where I am going wrong
      >
      > Select * from users where ref like '*JOH*' order by ref
      >
      > Thanks in advance
      >
      > --
      >
      > Kevin Martin
      > Motor Trade Technologies
      >
      >[/color]


      Comment

      • Starbuck

        #4
        Re: sql select question

        Thanks Guys

        "Jim Underwood" <james.underwoo d@fallonclinic. com> wrote in message
        news:%23XBSNOj3 FHA.1184@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > replace the * with % and you should be all set. I think the * is only for
        > microsoft access.
        >
        >
        > "Starbuck" <Starbuck@tisco ni.com> wrote in message
        > news:DUq9f.1980 2$Ce5.4413@news fe1-gui.ntli.net...[color=green]
        > > Hi
        > >
        > > The sql command below does not seem to work in SQL Server, can someone[/color]
        > show[color=green]
        > > where I am going wrong
        > >
        > > Select * from users where ref like '*JOH*' order by ref
        > >
        > > Thanks in advance
        > >
        > > --
        > >
        > > Kevin Martin
        > > Motor Trade Technologies
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...