Click here to Skip to main content
15,918,742 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Declare @Flag Varchar(50)=null

SELECT [uniquiID],
CountryFlag,
EventImage
,CONVERT(varchar(50), [StartDate],106) as StartDate
,CONVERT(varchar(50), [EndDate],106) as EndDate
,[EventName],[Description],[CountryCode],URL,
-- Case When N.Flag=1 then N.Remark when N.Flag=0 then N.Remark End as ''Remarks''
Remark,
Case when N.Flag=1 then 'Approved' when N.Flag=0 then 'Disapproved' when N.Flag= '' then 'Pending' else 'Forward' END as Status,

Flag

FROM TradefairData N
where 1=1

What I have tried:

above is my code when i Execute then Null Value not get and not showing Pending where Get Null Value so Please Help Me How to Use
Posted
Updated 29-Aug-17 0:34am

 
Share this answer
 
Quote:
not showing Pending where Get Null Value
If I understand you correctly, you want your WHERE clause to include cases where N.Flag is also NULL.

This is very easy, you just need to COALESCE it.
SQL
when COALESCE(N.Flag, '') = '' then 'Pending'

This means if N.Flag is either null or blank.
 
Share this answer
 
(CASE WHEN  (CONVERT(VARCHAR,columnname) is null or CONVERT(VARCHAR,columnname) = 0 ) THEN ''
 
Share this answer
 
v2
Comments
CHill60 29-Aug-17 12:13pm    
Use ISNULL or COALESCE
when isnull(N.Flag, '') = '' then 'Pending'
 
Share this answer
 
Comments
CHill60 29-Aug-17 12:14pm    
You've added nothing new to the thread!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900