faqts : Computers : Databases : Microsoft Access

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

18 of 37 people (49%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

using sql how do i select a portion of a field for eg 00091234 i only need 91234

Oct 3rd, 2002 22:54
Lindsay Jenkinson, jay williams,


The "Mid" function is usually the most common for substring operations, 
use it as: Mid([fieldname / string],start,number of chars):

  SELECT Mid("00091234",4,5) FROM [table_name];

In your case the "Right" function may be more applicable as provides a 
specified number of characters from the RHS of the string:

  SELECT Right("00091234",5) FROM [table_name];

NOTE: there is also a "Left" function which operates similarly