Somehow, null will always exists in the database.
Without doing some null checking at your code, you will get an error.
One way to fix it is by using isNull at your query. Basically this check, if counter is null, then a No value string will be assigned to it.
SELECT isnull(counter,’No value’) AS counter FROM test
So, the output will becomes,
counter |
99 |
12 |
34 |
No value |