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 2000 Forums
 Transact-SQL (2000)
 Extract certain text to columns

Author  Topic 

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-05-18 : 04:10:49
Hi Guys,

I’m trying to find out if there is a method that I can use to extract the Abtext columns into separate columns, see the current table example below

ID AbText
1775780 <B>Purpose</B> – Test data 1. <B>Design</B> Test Data 2 <B>Findings</B> – Test data 3

And im trying to get the information into separate columns i.e.

ID Purpose Design Findings
1775780 Test Data 1 Test data 2 Test Data 3


Is there ways of doing something like this, I’ve been looking at using Patindex but can’t seem to get the correct results.

Cheers in advance guys

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-05-18 : 05:38:12
anyone - or am i best off looking down the patindex route
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-05-18 : 07:12:52
you could export the data to a flat file ( using REPLACE to switch the <B>Findings</B> to a 1 character delimiter (try pipe |) and then use import tolls to put it back into your database.

Do you know how many columns you are going to end up with or do you need a completely dynamic approach?




Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -