Home > database >  The SQL how to write?
The SQL how to write?

Time:03-27

 
IF OBJECT_ID (' tempdb for.. # Goods') IS NOT NULL
DROP TABLE # Goods

Select * # INTO Goods from
(
Select '1' cNo, '12000122' AS cGoodsNo, CAST AS fStock AS MONEY (33.33), 3.46 fPrice_In
Union all
SELECT cNo '2', '12000122' AS cGoodsNo, CAST (100 AS MONEY) AS fStock, 3.46 fPrice_In
Union all
Select '3' cNo, '12000122' AS cGoodsNo, CAST AS MONEY (10) AS fStock, 3.46 fPrice_In
) a

IF OBJECT_ID (' tempdb for.. # Find ') IS NOT NULL
DROP TABLE # Find

Select * # into the Find the FROM
(
SELECT '12000122' AS cGoodsNo, CAST AS MONEY (66.6) AS fNeed
) A




To get the following results


  • Related