Re: Creating a view with subscripting
Posted in 2004
Thanks TBP, I did say "something like ..." and that I hadn't tested mine. dryburghj@yahoo.com (scottishpoet) wrote in message news:<81714288.0404160214.78e1e323@posting.google.com>... > probably best to write stored procedure that parses the fullname and > returns 2 values, lastname and the rest. > > something like > > proc parse_name(fullname) returning lastname, rest > define fullname, lastname, rest ... > define i INT > define value char(1) > > if fullname = NULL then > do some error handling > > let i = 1 > let value = fullname[i] > > while value != "," > let lastname[i] = value > let i = i+1 > end while > > let rest = name[(i+1), length] > -- i+1 becasue it needs to be the letter after the comma > > end procedure > > I haven't tried this and it probably need s tailoered a little, but > hopefully gives you some idea. > > > > jwalchle@mvnu.edu (John W) wrote in message news:<957b8c22.0404151925.25574dda@posting.google.com>... > > I have a 'fullname' field in my Informix database that I would like to > > separate into a first name and a lastname field in a view. The > > fullname field is of the format "Lastname, Firstname Middle". > > > > Is there a way to get just the last name for the view? I considered > > using a case statement and looking for the first comman in the field, > > such as: > > > > case > > when fullname[2,2] = "," then fullname[1,1] > > when fullname[3,3] = "," then fullname[1,2] > > when fullname[4,4] = "," then fullname[1,3] > > . > > . > > . > > > > But I'm not sure if I can do a case statement in a view. Plus I > > wouldn't know how to get the first name. > > > > Any suggestions? > > > > TIA, > > > > John