Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Split

Status
Not open for further replies.

DH

Programmer
Dec 8, 2000
168
Hello,

I have field which currently allows users to enter the ages of their children. Currently this information is entered in one field in the following format 2,12 which means 2 children of ages 2 and 12.

The following sql statement returns the information in one row:
SELECT dependentsages FROM testTable WHERE ID = @ID

So the result is:
2,12

However, I am looking for a way to modify the above SQL statement to return two rows to look like this:
2
12

I have a split function and tried (didn't work):
SELECT Split(dependentsages,',') FROM testTable WHERE ID = @ID

Any suggestions or examples would be appreciated.

Thank you,
DH
 
Check out this post.

thread183-1336767

George has written a function in it that you should be able to modify to split your field.

- Paul [batman]
- If at first you don't succeed, find out if the loser gets anything.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top