2 Replies - 1736 Views - Last Post: 22 November 2012 - 10:09 PM Rate Topic: -----

#1 edwmunya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 20-November 12

Splitting Names

Posted 22 November 2012 - 02:45 AM

Hello
There,

How can one separate a text into 2 columns (FirstName and LastName).
The only Hint I have is the UpperCase of the second name.
Eg. EdwardJohn I want it to be Edward in one column and John in the second column.
Any help shall be appreciated
Is This A Good Question/Topic? 0
  • +

Replies To: Splitting Names

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4319
  • View blog
  • Posts: 12,101
  • Joined: 18-April 07

Re: Splitting Names

Posted 22 November 2012 - 11:19 AM

You haven't told us what database you are using. MySQL has functions like Locate()/Instr() which you could use to find the position of a string in another (like searching for the upper case letter of the last name). You can also use SUBSTR to then use that position to break the string.

But of course the available functions depends on the database. Either way, look through the string functions available to your database, find the functions that can first locate the upper case of the last name and return a position. Once you have that, you can pull substrings/split based on that position.

:)
Was This Post Helpful? 0
  • +
  • -

#3 edwmunya  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 20-November 12

Re: Splitting Names

Posted 22 November 2012 - 10:09 PM

thanks for your reply.My database is Sql Server 2008.I know there is a substring function and uppercase function.
However I am getting difficulties to use to get my desired results.
Please if possible can you go deeper and write the syntax?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1