Select: return '0' if the value of the field is NULL

Below is a select statement, some of the fields may return "NULL" I will use this select statement to insert the values into another database that doesn't allow nulls. How can I modify this select statement to that it returns '0' if the field value is NULL?

SELECT 
  firmid,
  UserId,
  UserLoginId,
  IndvClientModule,
        1 AS sec_questionnaire,
        CMSContacts ,
        CMSCases ,
        CMSEmployers,
        SUBSTRING(AccessRights, 7, 1)AS sec_billing ,
        0 AS sec_regionalcenters,
        0 AS sec_agents,
        1 AS sec_messages,
        CMSReports ,
        1 AS sec_blankforms,
        1 AS sec_calendar,
        RCAccess ,
        1 AS sec_usefullinks,
        SUBSTRING(AccessRights, 2, 1) AS cases_general ,
        SUBSTRING(AccessRights, 3, 1) AS cases_links,
        SUBSTRING(AccessRights, 5, 1) AS case_notes,
        1 AS cases_reminders,
        SUBSTRING(AccessRights, 6, 1) AS case_documents,
        SUBSTRING(AccessRights, 8, 1) AS case_steps,
        SUBSTRING(AccessRights, 9, 1) AS cases_related,
        SUBSTRING(AccessRights, 10, 1) AS cases_main,
        SUBSTRING(AccessRights, 11, 1) AS cases_forms,
        Deletefiles ,
        0 AS activity_EB5,
        Uploadocs ,
        SecBillingedit ,
        SecBillingdelete ,
        BillingTrstaccnt 
 FROM Userlogin

Open in new window

LVL 1
AleksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russ SuterCommented:
Use the COALESCE function. It will return the first non null value in an argument list.

SELECT
  COALESCE(column1, 0)
FROM
  Table1

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PortletPaulfreelancerCommented:
ISNULL(column,0)   can be used in SQL Sever

COALESCE is available in many SQL dialects
0
AleksAuthor Commented:
Thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.