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 Administration
 Can anyone help me with Date-format please :)

Author  Topic 

Jamalo
Starting Member

6 Posts

Posted - 2010-08-10 : 09:58:30
Hello,
I have a problem to define that date in my query.
I want to check TABLE A there the date should be in date-format ddmmyyyy and it should check that the date is not in future. it should check the date with current or system date.

I use this quesry but it gives me just the date format;

SELECT *
FROM public."TABLE_A" AS t

Where
(
to_date(t."DATE", 'ddmmyyyy') < to_date('01011980','ddmmyyyy')
)
;

Please help me with this

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-08-10 : 10:32:07
Are you using SQL SERVER ?
Above Statement is not looking SQL SERVER Statement.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

Jamalo
Starting Member

6 Posts

Posted - 2010-08-10 : 10:36:57
This is PostgreSql :)

quote:
Originally posted by vaibhavktiwari83

Are you using SQL SERVER ?
Above Statement is not looking SQL SERVER Statement.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER

Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-08-10 : 10:38:43
So I think you should post your question in PostgreSql forum to get quick and correct answers.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

Jamalo
Starting Member

6 Posts

Posted - 2010-08-10 : 10:43:03
but how would you make query in Sql server for the same question then?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-10 : 10:55:16
SELECT *
FROM public.TABLE_A AS t
Where
(
right(DATE,4)+substring(DATE,3,2)+left(DATE,2) < getdate()
)


Madhivanan

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

- Advertisement -