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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Filter Query By Year & change dated automatically
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tdnguyen
Starting Member

USA
2 Posts

Posted - 01/21/2014 :  12:34:24  Show Profile  Reply with Quote
Hello, I have a data column named Date_In with format of 20-May-13. How can I filter the data to select based on year only. I used

Select 

*

From apps.xdmc_852@erpprod

Where Year(Date_in) = 2014


This code is not working.

I also need a way to automatically update to next week range. For example, last week I used where function like this

Where Date_in = to_date('01/12/2014','MM/DD/YYYY')


Is there a way it will automatically at the next 7 days to the code above when the date is available. This week I have to go back and changed the code in to this:

Where Date_in = to_date('01/19/2014','MM/DD/YYYY')



TDN

Lamprey
Flowing Fount of Yak Knowledge

4614 Posts

Posted - 01/21/2014 :  13:48:37  Show Profile  Reply with Quote
Just to clarify, you have a column called Date_In and that column contain string values of dates formatted like DD-MMM-YY (20-May-13)?

If that is the case, do you have the option of changing that column to a proper date column? That would make like a lot easier.

Plus, it looks like you are using Oracle. This is a SQL Server forum, so you might get better help on a forum specific to Oracle.

Edited by - Lamprey on 01/21/2014 13:50:43
Go to Top of Page

tdnguyen
Starting Member

USA
2 Posts

Posted - 01/21/2014 :  13:54:11  Show Profile  Reply with Quote
Do you know any forums for Oracle?

TDN
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/22/2014 :  07:25:21  Show Profile  Reply with Quote
quote:
Originally posted by tdnguyen

Do you know any forums for Oracle?

TDN


yep
www.orafaq.com
www.dbforums.com

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000