| Author |
Topic  |
|
|
AskSQLTeam
Ask SQLTeam Question
USA
0 Posts |
|
|
Anonymous
Starting Member
0 Posts |
|
|
skwilinski
Starting Member
1 Posts |
Posted - 09/22/2007 : 18:50:55
|
For those who are interested, in Access, it would be something like:
IIf(IsNull(COLUMN_VAL),0,COLUMN_VAL)
Thanks for the coalesce tip, it had slipped my mind. |
 |
|
|
Kristen
Test
United Kingdom
22191 Posts |
Posted - 09/23/2007 : 02:51:34
|
"Thanks for the coalesce tip, it had slipped my mind."
COALESCE() allows multiple choices:
COALESCE(Expression1, Expression2, Expression3, ...)
whereas IsNull only allows two.
And IsNull has peculiar behaviour on implicit casting, based on the first parameter I think, which can cause the value in the second parameter to be truncated etc.
And coupled with the confusing name I never use IsNull.
Kristen |
 |
|
|
jsmith8858
Dr. Cross Join
USA
7423 Posts |
Posted - 09/23/2007 : 10:24:44
|
quote: Originally posted by skwilinski
For those who are interested, in Access, it would be something like:
IIf(IsNull(COLUMN_VAL),0,COLUMN_VAL)
Thanks for the coalesce tip, it had slipped my mind.
Access has a "NZ" function that is basically the same as IsNull() in SQL:
nz(COLUMN_VAL,0)
- Jeff http://weblogs.sqlteam.com/JeffS
|
 |
|
|
madhivanan
Premature Yak Congratulator
India
22461 Posts |
Posted - 09/24/2007 : 01:42:44
|
quote: Originally posted by Kristen
"Thanks for the coalesce tip, it had slipped my mind."
COALESCE() allows multiple choices:
COALESCE(Expression1, Expression2, Expression3, ...)
whereas IsNull only allows two.
And IsNull has peculiar behaviour on implicit casting, based on the first parameter I think, which can cause the value in the second parameter to be truncated etc.
And coupled with the confusing name I never use IsNull.
Kristen
Initially I thought ISNULL() should return 1 or 0 like other functions ISNUMERIC(), ISDATE(), etc until I see it in BOL that it is simplest verion of COALESCE and specific to SQL Server. It is confusing to have ISNULL in both front end and backend which behaves entirely different. I stopped using ISNULL at backend
Madhivanan
Failing to plan is Planning to fail |
Edited by - madhivanan on 09/24/2007 01:44:21 |
 |
|
| |
Topic  |
|