how to grab characters that preeced a delimeter in a filed?

Posted on 2011-05-10
Last Modified: 2012-05-11
how to grab characters that preeced a delimeter in a field?  I would like to grab all teh characters to the left of the first delimeter in my field.  For example if the text in the field is 02/20/2010 then return 02, if it is 2/20/2010 then return 2, it the text is 002/20/2011 then 002
Question by:kat50
    1 Comment
    LVL 39

    Accepted Solution

    SELECT LEFT('02/20/2010',CHARINDEX('/', '02/20/2010')-1) )

    with column name

    SELECT LEFT(col_name,CHARINDEX('/', col_name)-1) )

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now