| Author |
Topic |
|
sardinka
Posting Yak Master
142 Posts |
Posted - 2005-08-19 : 08:29:22
|
| Can I do something like this:set Birthdate=' 'If my Birthdate is smalldatetime with no default value |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-19 : 08:36:40
|
| YesBut the value will be stored as 1900-01-01 00:00:00MadhivananFailing to plan is Planning to fail |
 |
|
|
sardinka
Posting Yak Master
142 Posts |
Posted - 2005-08-19 : 08:46:49
|
| So there is no way to get just empty datetime? |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-19 : 08:47:41
|
| NULL ?Kristen |
 |
|
|
sardinka
Posting Yak Master
142 Posts |
Posted - 2005-08-19 : 08:52:33
|
| I have Null but I need ''. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-19 : 08:54:19
|
| >>I have Null but I need ''.why?Do you want to show them in Reports?MadhivananFailing to plan is Planning to fail |
 |
|
|
sardinka
Posting Yak Master
142 Posts |
Posted - 2005-08-19 : 08:58:05
|
| Some of my asp.net code doesn't have a logic to support return value Null from a db, so I was thinking to update NULL value to '' .If it not possible I will add some logic to suppport NULL value in my code. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-19 : 09:06:36
|
| WellUse thisSelect otherColumns, case when Birthdate is null then '' else Birthdate end from yourTableMadhivananFailing to plan is Planning to fail |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-08-19 : 09:25:09
|
| I think the right thing to do is to have your code be able to deal with nulls, but otherwise Madhivanan's solution will work (with a tweek):case when Birthdate is null then '' else convert(varchar,Birthdate,101) endEDIT:otherwise it will still come over as: 1900-01-01 00:00:00Be One with the OptimizerTG |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-19 : 09:40:15
|
| Thats Correct TGDid you notice that all numbers will work with empty string conversion?select convert(varchar,'',0)select convert(varchar,'',-10)select convert(varchar,'',230948)select convert(varchar,'',230948)MadhivananFailing to plan is Planning to fail |
 |
|
|
|