Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 A select to pick datetime from a date column

Author  Topic 

SQLNotGoodForME
Starting Member

4 Posts

Posted - 2009-10-14 : 13:12:58
Hello, i have this question. In a certain table there is a colomn DATE(DD/MM/YYYY)

Now i don't know how but it happened in that column there are some valus like 12/06/2009 13:25:20, basically datetime values.

What i need is a query to pick all those rows where the colomn DATE has that kind of values. Thanks.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-10-14 : 13:16:15
SELECT * FROM myTable WHERE myDateColumn<>DateAdd(day, DateDiff(day, 0, myDateColumn), 0)
Go to Top of Page

SQLNotGoodForME
Starting Member

4 Posts

Posted - 2009-10-14 : 13:29:51
I forgot to mention, in Oracle SQL
Go to Top of Page

SQLNotGoodForME
Starting Member

4 Posts

Posted - 2009-10-14 : 13:32:10
The DATEADD doens't seems working, not a recognized stat, is there a way to check by lenght? Thanks.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-10-14 : 13:37:31
OracleSQLNotGoodForMSSqlServerForum


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-10-14 : 14:35:31
http://ss64.com/ora/syntax-datatypes.html

doesn't seem to be an oracle date though

and here I have to get back into the Oracle world

Not very happy



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-15 : 02:50:37
quote:
Originally posted by SQLNotGoodForME

I forgot to mention, in Oracle SQL



SELECT * FROM myTable WHERE myDateColumn<>to_char('DD-MMM-YYYY',myDateColumn)

But it is better you post in Oracle forums such as www.orafaq.com


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SQLNotGoodForME
Starting Member

4 Posts

Posted - 2009-10-16 : 05:26:24
It works now. Thanks for support.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-16 : 05:45:10
quote:
Originally posted by SQLNotGoodForME

It works now. Thanks for support.


You are welcome

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -