Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. command to find specific value in select

command to find specific value in select

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dabuskol
    wrote on last edited by
    #1

    Help!!! How can I find specific value from a field in a select list where the specific value varies in position. ex; Record1 A-'Telec:144' Record1 B-'Telecom:145' How to find the ":" using the SQL so I can get the 2 value in one field.. pls.. Dabuskol

    Dabsukol

    A 1 Reply Last reply
    0
    • D dabuskol

      Help!!! How can I find specific value from a field in a select list where the specific value varies in position. ex; Record1 A-'Telec:144' Record1 B-'Telecom:145' How to find the ":" using the SQL so I can get the 2 value in one field.. pls.. Dabuskol

      Dabsukol

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Use substring to get the characters, and charindex to find the :

      declare @a varchar(20)
      set @a = 'Telec:144'
      select substring(@a,1,charindex(':',@a)-1),substring(@a,charindex(':',@a)+1,len(@a))

      will return Telec for the first 1 and 144 for the 2nd

      Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

      D 1 Reply Last reply
      0
      • A Ashfield

        Use substring to get the characters, and charindex to find the :

        declare @a varchar(20)
        set @a = 'Telec:144'
        select substring(@a,1,charindex(':',@a)-1),substring(@a,charindex(':',@a)+1,len(@a))

        will return Telec for the first 1 and 144 for the 2nd

        Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

        D Offline
        D Offline
        dabuskol
        wrote on last edited by
        #3

        You are correct... Thanks for the immediate reply you save me on my last minute. Thanks...

        Dabsukol

        A 1 Reply Last reply
        0
        • D dabuskol

          You are correct... Thanks for the immediate reply you save me on my last minute. Thanks...

          Dabsukol

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          No problem

          Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups