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
 TO_Date?

Author  Topic 

disciple
Starting Member

27 Posts

Posted - 2006-04-08 : 20:46:10
Ok i'm trying to figure out how to properlyuse the to_date function. Ive read about it in my book and tried looking up some examples of it online... but im still confused on how to use it in my situation.


SELECT TITLE,INITCAP(PUBDATE(TO_DATE(PUBDATE,'Month DD, YYYY'))) FROM BOOKS;

That was my last attempt. Im just trying to get the title and the date for all of the books in the books table. the first letter of the book is supposed tobe capitalized, so i used initcap but then im supposed to put them month in Month DD, YYYY format. I looked it up, seems To_date is my answer but all of the examples seem to confused me. They are all being used along with where functions and I think its confusing me. Can anyone help explain how to use it in this situation?

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-08 : 20:54:00
I this Oracle?
I suspect you want initcap on the title.
to_date converts from a string to a date whereas I suspect you want to convert a date to a string.


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

disciple
Starting Member

27 Posts

Posted - 2006-04-08 : 20:54:55
yeah its oracle. Actually I wanted the months first letter to be capitalized.
Go to Top of Page

disciple
Starting Member

27 Posts

Posted - 2006-04-08 : 20:56:48
Ooooh I see what I was doing wrong now! To_char is what I should have been using. Much thanks for the nudge
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-10 : 03:02:00
This is MS SQL Server forum. Post your Oracles questions at relevent forums like www.DBForums.com

Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-10 : 03:19:04
disciple,

All this while the questions you ask is it for the Oracle Database ? It it is, it will be better if you ask it over at a Oracle Forum. The advice or solution we have given will works on SQL Server and might or might not be applicable to Oracle. Or with Oracle, maybe there might be a better way of approach to your problems.

Feel free to post any MS SQL Server related question here but your question on Oracle will have much better answer in the Oracle Forums.



KH


Go to Top of Page
   

- Advertisement -