Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » SQL




 Page 1 of 1 [ 5 posts ] 



Author Message
 Post subject: How 2 parse a field like "LastName,FirstName"
 Post Posted: Tue Nov 17, 2009 12:13 pm 
Offline

Joined: Sat Feb 21, 2009 12:35 pm
Posts: 52
Hello, I requird sum help being pointd in da right direction. I m havin a
field in ma Customer table calld name dat was "LastName,FirstName". I must
be able 2 return a result set wid the "FirstName,LastName". Ne ideas?


Top 
 Post subject: Re: How 2 parse a field like "LastName,FirstName"
 Post Posted: Tue Nov 17, 2009 12:13 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
Use CHARINDEX 2 get da position of ',' nd SUBSTRING 2 get da rest
of da string as FirstName.


Top 
 Post subject: Re: How 2 parse a field like "LastName,FirstName"
 Post Posted: Tue Nov 17, 2009 12:14 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
hi!

Code:
select fname+','+lname as NameOfPerson from mytable


Top 
 Post subject: Re: How 2 parse a field like "LastName,FirstName"
 Post Posted: Tue Nov 17, 2009 12:14 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
hi!

sorry for the wrong reply


Top 
 Post subject: Re: How 2 parse a field like "LastName,FirstName"
 Post Posted: Tue Nov 17, 2009 12:15 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
bad design. your column should be separated into two columns.


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 5 posts ] 




Board index » Server Side Development » SQL


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron