I have a big table with some NULLs in it. What is the easiest possible way to select from the table with 0’s instead of NULLs.
Or if there is no easy way to do that, I’m willing to physically replace all the nulls with 0’s in the table.
There is lots of columns, I don’t want to have to go through each one with something like ISNULL(FieldName,0) AS FieldName.
As many here have said, the best approach is ISNULL(), however if you want an easy way to generate all those ISNULL()’s use the following code:
This will make the tedious job a whole lot easier, you then just have to edit the output to account for the various field types (int, varchar, dates, etc)
Edit: accounting for various datatypes with default values..