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 |
|
Apples
Posting Yak Master
146 Posts |
Posted - 2008-03-25 : 18:06:37
|
| I've inherited a terribly designed database. When cells in the tables have nothing in them, rather than being NULL, they're just empty. So now I can't use COALESCE...Is there a way for COALESCE to check if a cell is empty instead of NULL? And if not, is there a way to get around this? |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-03-25 : 18:17:01
|
If they are text fields blank makes sense to me. But, you should take a look at the NULLIF function. DECLARE @Foo VARCHAR(50)SET @Foo = ''SELECT COALESCE(NULLIF(@Foo, ''), 'Unknown') |
 |
|
|
|
|
|