建立临时的表 数据 空值 与 NULL 转换

时间:2023-12-10 15:34:02

if exists ( select * from INFORMATION_SCHEMA.tables
where table_name = 'Config_Order_ChargesToPreView')
drop table Config_Order_ChargesToPreView
select * into Config_Order_ChargesToPreView from Config_Order_Charges

select HMNUM
, case when ISNULL(SubHMNUM, '') = '' then HMNUM else SubHMNUM end as SubHMNUM
, pc.ParcelSize
into #pc
from ProductCartons pc inner join (
select MAX(ProductCartonsID) as id
from ProductCartons
group by HMNUM, case when ISNULL(SubHMNUM, '') = '' then HMNUM else SubHMNUM end
) b on pc.ProductCartonsID = b.id