locked
SubString RRS feed

  • Question

  • User-592488039 posted

    All,

    Trying to extract information using substring and it is comming back undefined function:

    SELECT substring([Node],1,charIndex([Node],':')-1)
    FROM [EMS Year];

    The data looks like:     21:2:189

    Trying to extract the numbers to the left of the first :

    Help,

    David / 2007 Access

    Tuesday, December 27, 2011 4:19 PM

Answers

  • User-1360095595 posted
    Just realized you're trying to do this in access not SQL server. It looks like you need to use instr & mid. Refer: http://www.accessmonster.com/Uwe/Forum.aspx/access-queries/12824/Substring-and-Charindex-fuctions-in-Access
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 27, 2011 4:46 PM

All replies

  • User-1360095595 posted
    Try using: charIndex(':', [Node])-1
    Tuesday, December 27, 2011 4:30 PM
  • User-592488039 posted

    Here is what i put in:

    SELECT charIndex(':', [Node])-1
    FROM [EMS Year];

    Result: Undefined function in expression

    Tuesday, December 27, 2011 4:36 PM
  • User-1360095595 posted
    Just realized you're trying to do this in access not SQL server. It looks like you need to use instr & mid. Refer: http://www.accessmonster.com/Uwe/Forum.aspx/access-queries/12824/Substring-and-Charindex-fuctions-in-Access
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 27, 2011 4:46 PM