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
 SQL Server Development (2000)
 How do I break up text data stored in a SQL 6.5 text column thats > 255?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-28 : 00:46:59
Charlie Pyne writes "Ok... This one has stumped me and the SQL Guru here. I'm working on data cleanup/normalization project for a very poorly written application. Part of this application stores a list of "Projects" and "Tasks" that are associated with them. Instead of having a separate table of tasks and a foreign key that references the project table, the original developers stuck all the tasks together in one column the Projects table separated by carriage returns...

ex.

purchase equipment{cr}install equipment{cr}bill customer{cr} etc. etc.

HOW CAN I BREAK UP THESE TASKS INTO INDIVIDUAL ROWS IN A NEW TABLE??

My plan was to somehow use SUBSTRING() and a cursor to grab whatever is between the carriage returns, but when I realized that 6.5 doesn't allow you to use SUBSTRING on TEXT columns that plan fell apart..

Converting to varchar first isn't an option because just about every row is longer than 255.

Do you know of anything I can do that doesn't involve a SQL 7 upgrade?

-Charlie"
   

- Advertisement -