Reputation: 49
I Have a View in SQL Server, in one column ( data type int64) it returns Null value! But I want to display Zero in it. How Can I define a default Value for Column in View?
Upvotes: 2
Views: 1586
Reputation: 7562
You can use ISNULL, or better, COALESCE to return a value instead of a null.
SELECT COALESCE(FieldName, 0) AS FieldName
FROM Table
Upvotes: 1
Reputation: 176896
use isNull may resolve your issue like as velow
CREATE VIEW dbo.MyView
AS
SELECT col1, col2, isnull(numriccal3 ,0)
FROM mytable
Upvotes: 1