PDA

View Full Version : Splitting a column


mammoth
09-20-2004, 03:53 PM
Dear all,

I have been looking for what must be a simple answer to this question:

Is it possible, using ASP, to split a column into two or more, based on its contents?

To be more specific: I have an Access database table with a column that contains Name(s) and Surname(s) of a large number of people. The Name(s) and Surname(s) are separated by space characters. It seems to me that there would be an easy way to cut and paste, as it were, values from the initial column into several new ones.

TIA,
Mats

selwonk
01-02-2007, 01:02 PM
Yep - try Split()<%
str_Column = obj_RS("TheColumn")
ary_Column = Split(str_Column, " ")
str_Name = ary_Column(0)
str_Surname = ary_Column(1)
%>This presumes that there is only ever two words in the column