All Time Show Null value
Please help me what is the wrong in my code

declare @mxdbvlu  int
 declare @dbvlunm int
  set @mxdbvlu= (select max(Database_name) from TBL_FY_SELECT_1)
 if @mxdbvlu = null 
 set @dbvlunm=1000
 else 
 set @dbvlunm=sum(@mxdbvlu+1)
  select @dbvlunm,@mxdbvlu
Re: All time show NULL value please help me... 80 80

Hopefully in line 4. if @mxdbvlu == null instead of if @mxdbvlu = null

Re: All time show NULL value please help me... 80 80

I think there should be Column_name insted of Database_name
and there should be "if @mxdbvlu is null" insted of "if @mxdbvlu = null"
I tried after these changes and its working

Re: All time show NULL value please help me... 80 80

A null is never equal to something, a value can't equal null, as a null just doesn't exist. That's why you have to use the options suggested above. The second suggestion "if @mxdbvlu is null" is the standard way to test for not existing, as it says if a value doesn't exist...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.