UPDATE VS4TInventoryLOT Set TIMCStockId=RIGHT(''+(TIMCTPDtCode)+'-'+RIGHT('0000'+YEAR(GETDATE()),4)+RIGHT('00'+MONTH(GETDATE()),2)+RIGHT('00'+DAY(GETDATE()),2)+'-'+SUBSTRING(convert(varchar(10), GETDATE(), 108),1,2)+SUBSTRING(convert(varchar(10), GETDATE(), 108),4,2)+'-'+right('00000'+RAND(),4),30)
WHERE TIMCStockId is null or TIMCStockId = ''
GO