Prev: FILESTREAMING SQL 2008 R2
Next: SQL query help
From: Installing Windows2008R2OnWindows7VM on 11 May 2010 14:11 I am using SQL Server 2008. I am runnung a SQL statement against several tables. The data for the most part is all stored in varchar fields. I cannot change the datatypes. it is a commercial application and I would break it. Anyway one of the fields (Add_Date) stores a date like this 11/22/2009. I need records where this field has a date value in it. Problem with using not null or not "" is there are some values stored as amounts as well $ 123.45 0.00 123.00. How could I get only the records with a date value in this field? Thanks
From: Plamen Ratchev on 11 May 2010 17:20 Try the ISDATE function: WHERE ISDATE(AddDate) = 1 -- Plamen Ratchev http://www.SQLStudio.com
From: Installing Windows2008R2OnWindows7VM on 12 May 2010 07:27 Plamen: That filterd out the amounts. I found out there is another set of values in percents 10%. I tried DateField NOT IN ('%') but is still shows up. Any ideas? TIA "Plamen Ratchev" wrote: > Try the ISDATE function: > > WHERE ISDATE(AddDate) = 1 > > -- > Plamen Ratchev > http://www.SQLStudio.com > . >
From: Plamen Ratchev on 12 May 2010 10:50 I though this is what you want. You asked to select only valid date values and this is what ISDATE does. For amounts you can check with ISNUMERIC. -- Plamen Ratchev http://www.SQLStudio.com
From: Gert-Jan Strik on 13 May 2010 08:24 So what kind of "wrong" data still shows up after putting it through ISDATE? Do you have examples? -- Gert-Jan Installing Windows2008R2OnWindows7VM wrote: > > Plamen: > > That filterd out the amounts. I found out there is another set of values in > percents 10%. I tried DateField NOT IN ('%') but is still shows up. Any > ideas? > > TIA > > "Plamen Ratchev" wrote: > > > Try the ISDATE function: > > > > WHERE ISDATE(AddDate) = 1 > > > > -- > > Plamen Ratchev > > http://www.SQLStudio.com > > . > >
|
Pages: 1 Prev: FILESTREAMING SQL 2008 R2 Next: SQL query help |