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)
 Note line breakdown

Author  Topic 

burnside63
Starting Member

2 Posts

Posted - 2011-08-17 : 17:58:38
I am converting data from one database to another. I have all but this last piece done and this one is driving me batty. The data has 3 columns, with the first 2 being account numbers and the 3rd being a note line. Each note line begins with mm-dd-yyyy @ hh:mm XXX with XXX being the user. The actual notes follow after this beginning. Each time a person puts a new note on the account, the new notes is pushed into the beginning of the previous note lines, making one long note. This has to be converted into the new database in such a way that each note line begins with the date/time/user and then the notes. I need a way to parse the notes so that each repetition of the date/time/user scenario becomes a new line. Any help? Below is an example of one of the lines.

Account 1 Account 2 Note
2206782>> 1122203>> 07-14-2011 @ 18:16 MMC - SCHDLD NEXT NOTICE TYPE 20100325 +155.00 Desc:SICKNESS PCR 20100325 +155.00 Desc:GC PROBE PCR 20100325 +104.00 Desc:HUMAN SICKNESS 07/05/11 MAC OLD NTCE: 07/05/11 A1 NEW NTCE: 07/05/11 8 07-06-2011 @ 16:05 MMC - OLD STATUS: NEW NEW STATUS: ACTIVE OLD NTCE: 07/05/11 8 NEW NTCE: 07/10/11 A1 OLD Pri: 1 NEW Pri: 2 07-12-2011 @ 09:55 Notices - OLD Pri: 2 NEW Pri: 1 07-14-2011 @ 18:16 MMC - OLD Pri: 1 NEW Pri: 3 >>

Bob Burnside

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-18 : 04:33:11
use a string parsing function for getting the split string values. see an example here

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

burnside63
Starting Member

2 Posts

Posted - 2011-08-19 : 13:41:22
This works great for a single, hard coded text field. I have 1.8M records to process where there is an account number preceding the note line. It needs to come out with a format of

account note
account note
account note.

Bob Burnside
Go to Top of Page
   

- Advertisement -