Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Null Values

Author  Topic 

stpn
Starting Member

8 Posts

Posted - 2015-01-20 : 04:58:03
I have table

CREATE TABLE [dbo].[tblreg]
(
[RN] [nvarchar](50) NOT NULL,
[SC] [nvarchar](6) NULL,
[DC] [nvarchar](12) NULL,
[BC] [nvarchar](21) NULL,
[PC] [nvarchar](30) NULL,
[VC] [nvarchar](54) NULL,
[Fy] [nvarchar](30) NULL,
[HabiN] [nvarchar](255) NULL,
[StN] [nvarchar](255) NULL,
[HN] [nvarchar](60) NULL,
[BN] [nvarchar](255) NULL,
[FN] [nvarchar](255) NULL,
[Min] [nvarchar](3) NULL
)

Output:
RN SC DC BC PC VC Fy HabiN StN HN BN FN Min
1 15 30 3 14 12 23 ABC SIDDA NULL PAR MAL NULL
2 15 30 2 18 14 23 XYZ NULL BIR NAU IMA 3
3 15 30 5 19 15 23 ABC SIDDA BAD YAN RAM NULL
4 15 30 7 20 16 23 ABC NULL NULL HAN NULL NULL
5 15 30 9 21 15 23 XYZ SIDDA BIR SHO RAM NULL

So when i write a select query i want the NULL Values should be displayed as zero in the output.

How to do this ?

Thanks

stpn
Starting Member

8 Posts

Posted - 2015-01-20 : 05:06:08
SELECT ISNULL(Column_Name,0) from TableName
Go to Top of Page
   

- Advertisement -