TSQL on SUBSTRING

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • benchpolo
    New Member
    • Sep 2007
    • 142

    TSQL on SUBSTRING

    Data:
    SPIRIVA CAP HANDIHLR
    HYDRALAZINE TAB 25MG

    Can someone please assist me using SUBSTRING to just filter SPRIVA and HYDRALAZINE value ?

    Thanks
  • yarbrough40
    Contributor
    • Jun 2009
    • 320

    #2
    Can you give more detail here? What is your larger task? The correct answer will depend on a few things. There are several ways to parse out a text.

    Comment

    • ck9663
      Recognized Expert Specialist
      • Jun 2007
      • 2878

      #3
      If you're trying to grab the first word before the first space, use CHARINDEX to get the position of first space and use SUBSTRING to get the string you need, relative the the position that the CHARINDEX will return.

      Good Luck!!!

      ~~ CK

      Comment

      • gpl
        New Member
        • Jul 2007
        • 152

        #4
        Take a look at the final result of this thread http://bytes.com/topic/sql-server/an...numbers-string
        It gives a simple method of retrieving values from a tokenised string

        Comment

        Working...