When you want to replace a possibly null
column with something else, use IsNull.
SELECT ISNULL(myColumn, 0 ) FROM myTable
This will put a 0 in myColumn if it is null in the first place.
More Related Contents:
- SQL Server dynamic PIVOT query?
- SQL Server – Best way to get identity of inserted row?
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- SQL Server Process Queue Race Condition
- Is the NOLOCK (Sql Server hint) bad practice?
- SQL Server 2005 Pivot on Unknown Number of Columns
- Creating table names that are reserved words/keywords in MS SQL Server [closed]
- SQL – Subtracting a depleting value from rows
- Stored procedure or function expects parameter which is not supplied
- Pass table as parameter into sql server UDF
- SQL Server Convert Varchar to Datetime
- There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key
- SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints
- Is it possible to delete from multiple tables in the same SQL statement?
- Dynamic update statement with variable column names
- How to return the output of stored procedure into a variable in sql server
- A way to extract from a DateTime value data without seconds
- How to select only the first rows for each unique value of a column?
- SQL Server (TSQL) – Is it possible to EXEC statements in parallel?
- Difference of two date time in sql server
- Modify Default value in SQL Server
- Unordered results in SQL
- Using PIVOT in SQL Server 2008
- Produce DISTINCT values in STRING_AGG
- Function in SQL Server 2008 similar to GREATEST in mysql?
- ORDER BY items must appear in the select list if SELECT DISTINCT is specified
- Query times out from web app but runs fine from management studio
- How do I compare 2 rows from the same table (SQL Server)?
- SQL INSERT INTO from multiple tables
- How to Execute SQL Query without Displaying results