debra f wrote:

I'm trying to determine how (if possible without writing
extension) to split a single column by a character value - for
example

Column AgeRange has values such as 20-30, 40-50

I'd like to do something like...

select substr(agerange,1,instr(agerange,'-')-1) as StartAge,
substr(agerange,instr(agerange,'-')+1) as EndAge

I don't see an instr function supported in sqlite - any ideas?

________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

Debra,

I think you will have to write your own user defined function to do this. The SQL standard defines a POSITION() function that returns the position of one string within another, but sqlite doesn't implement it. It should be fairly simple to provide your own function to do this. You can look at the standard functions in func.c for some examples of using the custom function API routines (the same routines are used to define all the standard functions; sum, round, substr, etc.).

HTH
Dennis Cote

Reply via email to