Replacement for "A*" used in Access

  • Hi, all.

    I posted some posts in forum for SQL Server Express edition, but now I am curious about T-SQL statement in SQL Server.

    I made some applications in Access 2003 and, for example had table with names of people, like

    Alexander

    Dianna

    Don

    John, etc.

    When I wanted to search for all the names that start with I, I used criteria "A*".

    I wonder what is replacement in SQL Server. I heard that it is %, but can anyone write me some simple example

  • where columnname like 'A%'

  • Thanks for the answer and question Lynn

    No, column names are PersonID, PersonName, etc.

    A* is criteria for searching data in Access query.

    I know that I should create View, select column PersonName, and in Filter write my criteria.

    Maybe

    SELECT * FROM PersonName AS Person

    WHERE PersonName IS 'A%'

    Am I right or not?

    Help me out

  • Ivan b (2/13/2009)


    Thanks for the answer and question Lynn

    No, column names are PersonID, PersonName, etc.

    A* is criteria for searching data in Access query.

    I know that I should create View, select column PersonName, and in Filter write my criteria.

    Maybe

    SELECT * FROM PersonName AS Person

    WHERE PersonName IS 'A%'

    Am I right or not?

    Help me out

    You're misunderstanding what Lynn was showing you. He was giving you the actual SQL syntax.

    To make it a little easier - if you apply Lynn's point to the example you just had, it would be:

    SELECT * FROM PersonName AS Person

    WHERE PersonName LIKE 'A%'

    In other words - LIKE is the operator instructing SQL Server to do a partial match (which incidentally is exactly what Access does as well if you look at the SQL it generated).

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Ivan b (2/13/2009)


    Thanks for the answer and question Lynn

    No, column names are PersonID, PersonName, etc.

    A* is criteria for searching data in Access query.

    I know that I should create View, select column PersonName, and in Filter write my criteria.

    Maybe

    SELECT * FROM PersonName AS Person

    WHERE PersonName IS 'A%'

    Am I right or not?

    Help me out

    Considering how much info you provided, I just gave you the SQL syntax for using LIKE in a WHERE clause.

    Matt is correct in his post.

    If you would like more complete, usable, and helpful answers to your questions, may I suggest you read the first article I have referenced below in my signature block regarding asking for assistance.

    Also, and I'm sure Matt will also agree, you should not use SELECT * in your views or queries. you really should explicitly name the columns you wish to return.

  • Thanks to both of you.

    I'm sorry for didn't realize that columname means SELECT FROM PersonName WHERE PersonName ...

  • Ivan b (2/15/2009)


    Thanks to both of you.

    I'm sorry for didn't realize that columname means SELECT FROM PersonName WHERE PersonName ...

    Well, how do we go from here:

    I made some applications in Access 2003 and, for example had table with names of people, like

    Alexander

    Dianna

    Don

    John, etc.

    When I wanted to search for all the names that start with I, I used criteria "A*".

    to here:

    SELECT * FROM PersonName AS Person

    WHERE PersonName LIKE 'A%'

    There was nothing in your original post to base any form of query. Again, that's why I suggested that you read the first article linked in my signature block. Following the guidelines there will get you much better answers to your questions on any forum you post a question.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply