SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 charindex
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

arkiboys
Flowing Fount of Yak Knowledge

1418 Posts

Posted - 10/08/2012 :  05:06:16  Show Profile  Reply with Quote
Hi,
tblMain has a field called clients.
This field has both the first and last name in it.
How can I separate the two into their own columns using sql?
May be this is to do with charindex and look for the first space and then take the first part as firstname and the second as lastname?
Thanks

senthil_nagore
Flowing Fount of Yak Knowledge

India
1007 Posts

Posted - 10/08/2012 :  05:08:09  Show Profile  Visit senthil_nagore's Homepage  Send senthil_nagore a Yahoo! Message  Reply with Quote
Post some sample data..

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

webfred
Flowing Fount of Yak Knowledge

Germany
8765 Posts

Posted - 10/08/2012 :  05:08:51  Show Profile  Visit webfred's Homepage  Reply with Quote
Please have a look here:
http://www.sqlteam.com/search.aspx?cx=011171816663894899992%3Aaow51lf_dim&cof=FORID%3A9&q=split+firstname+lastname


Too old to Rock'n'Roll too young to die.
Go to Top of Page

arkiboys
Flowing Fount of Yak Knowledge

1418 Posts

Posted - 10/08/2012 :  05:27:04  Show Profile  Reply with Quote
quote:
Originally posted by webfred

Please have a look here:
http://www.sqlteam.com/search.aspx?cx=011171816663894899992%3Aaow51lf_dim&cof=FORID%3A9&q=split+firstname+lastname


Too old to Rock'n'Roll too young to die.


Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000