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 2008 Forums
 Transact-SQL (2008)
 How to Split the data

Author  Topic 

karmeeabi
Starting Member

18 Posts

Posted - 2013-07-31 : 05:12:11
Hi All, Good Day,

i have an issue . i need to split the below mentioned data it is one 1 Row. this is the Exact information from the Table

Name : Karthik Shankaran
Skillset : Google
Question Type: unable to access google
Link : http://www.yahoo.com/us/support/owners/product/BD-c5500/CBB

i need to split this in a different column or add a new column as

Name
Skillset
Question Type
Link

and put the relevant information according to the respective row,

like this i have 10,00,000 records need your help in segregating them

Regards,
Karthik Shankaran (KS)
+91-9940074724

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-07-31 : 05:27:42
If format is consistent. do like this

SELECT RTRIM(LTRIM(REPLACE(LEFT(Field,PATINDEX('%SkillSet :%',Field)-1),'Name:',''))) AS Name,
STUFF(LEFT(Field,PATINDEX('%Question Type:%',Field)-1),1,PATINDEX('%SkillSet :%',Field)+10,'') AS Skillset,
STUFF(LEFT(Field,PATINDEX('%Link :%',Field)-1),1,PATINDEX('%Question Type:%',Field)+14,'') AS QuestionType,
STUFF(Field,1,PATINDEX('%Link :%',Field)+6,'') AS Link
FROM table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -