MySQL Forums
Forum List  »  Microsoft SQL Server

Re: Split String
Posted by: Amnon Levav
Date: December 17, 2007 09:46AM

If this is a one-time operation (e.g. import another DB), a simpler solution is to export the data and then use AWK to work on it.

Sample awk program which splits the 3rd parameter and does other things:

{ print "INSERT INTO term_node (nid, tid) VALUES (", $1, ",", $2, ");" }

length ($3)>0 {
nparts = split ($3, parts, ",");

for (i=1; i < nparts; i++) {
print "INSERT INTO term_node (nid, tid) VALUES (", $1, ",", parts, ");";
}
}

Options: ReplyQuote


Subject
Written By
Posted
March 27, 2006 10:10AM
April 12, 2007 04:29AM
Re: Split String
December 17, 2007 09:46AM
February 20, 2008 12:29PM
January 14, 2009 02:22PM
w c
January 29, 2009 10:05PM
March 18, 2009 03:13AM
January 24, 2008 06:17PM
March 04, 2008 08:50AM
August 23, 2008 04:33PM
January 14, 2009 01:40PM
September 08, 2008 04:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.