简体   繁体   中英

How to replace result set column value from null to string

I have a query in which i have retrieved data from multiple tables and results come correct. In the output "Date" column have Null values, now i want to update the output table in a way that the null values of Date field replaced by string. I don't know the output table name created by query, i tried table0, but in vain.

I tried

"update Table0 SET ActualStartDate='N/A' where ActualStartDate is NULL"

我认为当选择查询中的日期类型列为空时,您需要显示'N/A'

select ISNULL(cast( UpdateDate as  nvarchar),'N/A') from ImageGallery

We can do it as below.

DECLARE @Sold TABLE (SoldID VARCHAR(20))

INSERT INTO @Sold SELECT Null UNION ALL SELECT '1x1a' UNION ALL SELECT '2x1c'

SELECT ISNULL(SoldID,'') AS 'SoldID' FROM @Sold

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM