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.
| Author |
Topic |
|
sachin9183
Starting Member
3 Posts |
Posted - 2008-08-04 : 14:40:25
|
| Hi,I have an input coming as a TIMESTAMP and I want the output as MMM/YY in a date format data type. I have tried several combinations of TO_Date function but its not working, it throws an error as the output doesn't have DD[Date] in it.Any help ?? |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-08-04 : 15:10:41
|
| SQL Server doesn't have the MMM/YY format. The formatting should be done in the front end. In t-sql you coold do thisselect convert(varchar(3),yourdate,107)+'/'+ right(convert(varchar(12),yourdate,107),2)jim |
 |
|
|
sachin9183
Starting Member
3 Posts |
Posted - 2008-08-04 : 15:48:57
|
| Thanks for your reply !!the formatting can't be done at the front end, your solution gives me the output as varchar but I need the output as date data type |
 |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2008-08-04 : 16:03:31
|
| MMM/YY is a character representation of a datetime datatype, so is mm/dd/yyyy or Jul 04,1976. These are all character reps of a datetime value. How do you plan on using the value MMM/YY?Jim |
 |
|
|
sachin9183
Starting Member
3 Posts |
Posted - 2008-08-04 : 16:10:23
|
| I understand what you are saying, this is a kind of weird requirement from my business people. I'll just ask them that its technically not possible |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-05 : 04:51:23
|
quote: Originally posted by sachin9183 Thanks for your reply !!the formatting can't be done at the front end, your solution gives me the output as varchar but I need the output as date data type
Why do you want it as DATETIME?Where do you want to show formatted dates?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|