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. Splitting names in a SQLS 2K query ?

Splitting names in a SQLS 2K query ?

Scheduled Pinned Locked Moved Database
databasehelpquestionlearning
2 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.
  • J Offline
    J Offline
    Jerry Evans
    wrote on last edited by
    #1

    I've got rather a lot of cleaned data that has the title,first and last names stored as a single string in one column - is there a simplish way to split this out into 3 columns. e.g something like this ? select splitTitle(name) as title, splitFirst(name) as first, splitLast(name) as last from myTable Also what books do people recommend for learning this kind of stuff ? Many thanks for any help

    U 1 Reply Last reply
    0
    • J Jerry Evans

      I've got rather a lot of cleaned data that has the title,first and last names stored as a single string in one column - is there a simplish way to split this out into 3 columns. e.g something like this ? select splitTitle(name) as title, splitFirst(name) as first, splitLast(name) as last from myTable Also what books do people recommend for learning this kind of stuff ? Many thanks for any help

      U Offline
      U Offline
      User 799740
      wrote on last edited by
      #2

      Hi Jerry, You can split the values using substring and charindex in SQL Server. I guess, you have to write a stored procedure to split them based on delimiter by passing concatinated string and delimiter and get title, first and last names. I can help you in this, if you try out something.. Thanks, Srinivas

      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