I tried to run the script below, and it will display NULL value. I only want to get data for ALBANIA without having NULL value.
SELECT [COUNTRY_CODE_NEW]
,CASE WHEN SUBSTRING([COUNTRY_CODE_NEW], 6,2) = '16' THEN 'ALBANIA'
END 'COUNTRY'
FROM [dbo].[COUNTRY_NEW]
你可以做:
CASE WHEN SUBSTRING([COUNTRY_CODE_NEW], 6,2) = '16' AND IS NOT NULL THEN 'ALBANIA'
Just add a check to ensure it's not null:
SELECT
[COUNTRY_CODE_NEW],
CASE WHEN SUBSTRING([COUNTRY_CODE_NEW], 6,2) = '16' AND [COUNTRY_CODE_NEW] IS NOT NULL THEN 'ALBANIA'
END 'COUNTRY'
FROM [dbo].[COUNTRY_NEW]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.