Anakin Posted March 22, 2007 Share Posted March 22, 2007 Help me with it, can't think of anything else other than cricket tomorrow :hic: i have something like this, 01/2006, 01/05, 1/05, 1/2005 need to have one query that'll select all of them and extract only those values, tried with [0-9][0-9] but it selected only ones with 01/****, not 1/****, also how do you extract them when index will be different for each type. any help is appreciated :hic: :wtg: Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help BTW, using sql server, not oracle Link to comment Share on other sites More sharing options...
apocalypse Posted March 22, 2007 Share Posted March 22, 2007 Re: SQL help do you have a date formatter? Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help those are saved as text, need to extract them and convert them to datetime Link to comment Share on other sites More sharing options...
yoda Posted March 22, 2007 Share Posted March 22, 2007 Re: SQL help what about [0-9]+ (instead of [0-9][0-9]) which stands for "one or more digits"? btw this is regexp, so it depends on whether your db support regexp. Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help that's what i'm trying to figure out too, tried with [0-9]+, compiles but doesn't work, tried few other regexp too, but not working :wall: Link to comment Share on other sites More sharing options...
yoda Posted March 22, 2007 Share Posted March 22, 2007 Re: SQL help you could also do (coldate = '[0-9]xxx' or coldate = '[0-9][0-9]xxx') yyy where xxx is rest of your matching for the coldate and yyy is the rest of your where clause. Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help yep, that's what i did, but i can't extract the values in one shot then, unless there is some other way, the index for 01/2006 is different to 01/06 for substring method Link to comment Share on other sites More sharing options...
talksport Posted March 22, 2007 Share Posted March 22, 2007 Re: SQL help Not clear what the question is...but I will try lpad or ltrim first ... Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help Thanks BB, I'll look into this and I'll send an email or pm to you. Took friday off, so hopefully others will fix it by monday :hic: Link to comment Share on other sites More sharing options...
King Posted March 22, 2007 Share Posted March 22, 2007 Re: SQL help :hic: Link to comment Share on other sites More sharing options...
Anakin Posted March 22, 2007 Author Share Posted March 22, 2007 Re: SQL help Sorry boss :hic: Link to comment Share on other sites More sharing options...
Recommended Posts