P Kishor wrote... > On Wed, Dec 23, 2009 at 4:08 PM, jose isaias cabrera wrote: >> >> Greetings and salutations. >> >> I would like to trim a column from all white spaces. I know how to do it >> programmatically, but I would like to do it right to the DB. Is this a >> possibility? >> >> Image this statement: >> >> CREATE TABLE LSOpenJobs >> ( >> id integer primary key, >> ProjID integer, >> subProjID, >> parent, >> vEmail, >> notes, >> status >> ); >> >> say that I want o clean up the vEmail column by trimming all whitespaces >> at >> the beginning and the end of the data. I know that trim(vEmail) will do >> it, >> but what would be the command to run to trim all of the existing records? >> > > SELECT trim(col_name) FROM table > > If you want to create a new table, just SELECT the desired columns > into a new table > > CREATE TABLE trimmed_table AS SELECT trim(col1), trim(col2)... FROM > old_table; > >> Also, how to I trim specific characters? Say tab, or char(0) or char(X), >> etc? I know that I do trim(vEmail,Y), but how do I represent tab? or >> newline? etc.? >> > > \t for tab, \n for newline and so on. > > > > >> thanks, >> >> josé >> >
Thanks Puneet. josé _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users