执行如下脚本:
SELECT *
FROM sysobjects
WHERE name = 'tempcurrentstock' DROP TABLE TempCurrentStock
SELECT cWhCode, cInvCode, (CASE WHEN cFree1 = '' THEN NULL
ELSE cFree1 END) AS cFree1, (CASE WHEN cFree2 = '' THEN NULL
ELSE cFree2 END) AS cFree2, iainquantity AS iQuantity, CAST(0 AS FLOAT)
AS fOutQuantity, CAST(0 AS FLOAT) AS fInQuantity
INTO TempCurrentStock
FROM ia_subsidiary
WHERE cvoutype = '34'
GROUP BY ia_subsidiary.cWhCode, ia_subsidiary.cInvCode, ia_subsidiary.cFree1,
ia_subsidiary.cFree2, ia_subsidiary.iainquantity