Results 1 to 3 of 3

Thread: Mid in SQL?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 1999
    Posts
    25

    Post

    In VB you can get characters form a specified place form a string with mid function. Is there a similar function in SQL?

    thanks

    Jamppa

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Depends on the SQL. Transact-SQL (used by MS SQL Server) has a "charindex" function that appears to behave as "mid" does.

    Standard SQL does not, I believe, have this ability.

  3. #3
    New Member
    Join Date
    Aug 1999
    Posts
    5

    Post

    The Mid function can be used embedded into your SQL query if using DAO and connecting to Access.

    Using the following example would return all records where the name field contains the text 'ill' in character positions 2,3, and 4.

    Data1.RecordSource = "Select * from MyTable Where Mid(Name,2,3) = 'ill'"
    Data1.Refresh

    So records with the name 'Bill' and 'Jill' would be returned. Don't forget you may also need to embed a UCASE to avoid case senstivity.


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