Re: Need SQL Expert Help!

2005-11-11 Thread jonese
thanks all! erj On 11/11/05, Caroline Wise <[EMAIL PROTECTED]> wrote: > Oops, I think you wanted it the other way around... > select * > from [tablename] > where filename not like CAST(uploadID AS VARCHAR(50)) + '.%' > > > On 11/11/05, Caroline Wise <[EMAIL PROTECTED]> wrote: > > > > How about

Re: Need SQL Expert Help!

2005-11-11 Thread Greg Morphis
select * from foo where fooid != substr(file, 1, position('.' in file) - 1); That works for postgres, if using Oracle use the instr() function instead of the position() function. On 11/11/05, Greg Morphis <[EMAIL PROTECTED]> wrote: > is it always .doc or . followed by a 3 digit extension? > sele

Re: Need SQL Expert Help!

2005-11-11 Thread Caroline Wise
Oops, I think you wanted it the other way around... select * from [tablename] where filename not like CAST(uploadID AS VARCHAR(50)) + '.%' On 11/11/05, Caroline Wise <[EMAIL PROTECTED]> wrote: > > How about > select * > from [tablename] > where filename like CAST(uploadID AS VARCHAR(50)) + '.

Re: Need SQL Expert Help!

2005-11-11 Thread Caroline Wise
How about select * from [tablename] where filename like CAST(uploadID AS VARCHAR(50)) + '.%' HTH Caroline Wise On 11/11/05, jonese <[EMAIL PROTECTED]> wrote: > > we have an upload system that stores an uploadid and then the filename > of the file uploaded. > > the uploadid is just an int (10052

Re: Need SQL Expert Help!

2005-11-11 Thread Greg Morphis
is it always .doc or . followed by a 3 digit extension? select * from foo where fooid != substr(file, 1, length(file) - 4) That works if so... On 11/11/05, jonese <[EMAIL PROTECTED]> wrote: > we have an upload system that stores an uploadid and then the filename > of the file uploaded. > > the upl

Re: Need SQL Expert Help!

2005-11-11 Thread Deanna Schneider
You could do it like this in Oracle. I'd imagine you could swap functions for sql server: SELECT id, CASE WHEN idcolumn != TO_NUMBER(SUBSTR(filecolumn, 1,INSTR(filecolumn, '.')-1)) THEN 'bad record' ELSE 'good record' END as result FROM yourtable On 11/11/05, jonese <[EMAIL PROTECTED]> wrote: >

Need SQL Expert Help!

2005-11-11 Thread jonese
we have an upload system that stores an uploadid and then the filename of the file uploaded. the uploadid is just an int (100524) and filename is the uploadID plus the extention (100524.doc) I need a SQL script which will select those records where the uploadid doesn't equal the filename without