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 |
|
cullyK
Starting Member
5 Posts |
Posted - 2007-02-06 : 04:29:32
|
| I want to create a select statement that that will display 'NA' when recFD is '01/01/1900' otherwise it will display the date storedSelect recSD, recFD = CASE recFD WHEN '01/01/1900' THEN 'NA' ELSE recFD END, recFD From Table 1This works fine when I run, Select recSD, recFD = CASE recFD WHEN '01/01/1900' THEN 'NA' END, recFD From Table 1without the Else recFD but i need to display the recFD if it is not '01/01/1900'Thanks in advance for your help |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-06 : 04:35:19
|
| SELECT recSD, CASE WHEN recFD <= '19000101' OR recFD IS NULL THEN 'NA' ELSE CONVERT(VARCHAR, recFD, 103) ENDFROM Table1You can't mix datatypes in same column. Either convert 'NA' as date (not possible), or convert the date as string.Peter LarssonHelsingborg, Sweden |
 |
|
|
cullyK
Starting Member
5 Posts |
Posted - 2007-02-06 : 04:39:47
|
| That works perfect thank you |
 |
|
|
|
|
|