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 |
|
sgreeny
Starting Member
2 Posts |
Posted - 2009-10-09 : 01:40:36
|
| How to convert the following oracle statement to MS-SQL(1) select TO_DATE(MTH_NO||'-'||YR_NO,'MM-YYYY') FROM MyTable(2) SELECT NVL2(CURR_TM_MTH,TO_DATE(CURR_TM_MTH,'MM-YYYY'),SYSDATE) FROM MyTablePS Sample data: MTH_No = 2 (means feb) YR_NO = 1998 CURR_TM_MTH = 02-1998 (means mm-yyyy) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-09 : 01:52:48
|
| Do you want pure date value or formatted value?MadhivananFailing to plan is Planning to fail |
 |
|
|
sgreeny
Starting Member
2 Posts |
Posted - 2009-10-09 : 02:17:09
|
| Hi, Can I have both format? Thanks |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-10-09 : 03:07:50
|
| select DATEADD(month,month_no-1,dateadd(year,year_no-1900,0)) from your_tableLet the front end do format it like mm-yyyyMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|