Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Performing String operation

Author  Topic 

lols
Posting Yak Master

174 Posts

Posted - 2008-03-29 : 05:46:06
Hi,

I have got a column with the string "I too Love Sql Server". I am trying an output as shown below:

I want to divide this into 4 columns :

Column1    Column2          Column3    Column4
I too Love Sql Server I.t.L.S.S


The Column 4 contains the first letter of each word. If the string contains only 2 words, Eg: "Sql Server" then Column 2 will be empty and only Column 1,3 and 4 will be filled.

How do I do this?

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-03-29 : 07:47:26
What you'll have to do is:
1)How many words in the sentence?using the space as the delimeter
2)If 2 , then create INSERT statement , placing the separate words in col1 and 2
3)If more than 2 , adjust SQL statement to place the first and last word into col 1 and col3 , the remainder in col2
3)create process to take the first letter of every word to create the acronymn

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

lols
Posting Yak Master

174 Posts

Posted - 2008-03-30 : 23:20:13
Thanks...Please share the query for it
Go to Top of Page
   

- Advertisement -