笔记76 插入测试表数据,不能用rand随机数[Monitoring] 纯监控2012-11-20

笔记76 插入测试表数据,不能用rand随机数[Monitoring]  纯监控2012-11-20

 1 --插入测试表数据,不能用rand随机数[Monitoring]  纯监控2012-11-20
 2 USE [Monitoring]
 3 GO
 4 BEGIN
 5      DECLARE @a INT
 6      SET @a=1
 7      WHILE @a<=10
 8      BEGIN
 9                INSERT [dbo].[CT_Dis_FuelingData] (VC_FD_NO, I_FD_PumpID, VC_FD_OilType, DE_FD_Volume, DE_FD_Price, DE_FD_Amount, I_FD_Point, D_FD_Datetime, VC_FD_GroupNO, D_FD_GroupDate, Is_Pay, LI_FD_CTC)
10                SELECT CONVERT(int, @a*99),
11                CAST(RAND()*10 AS INT) ,
12                '93#',
13                CAST(RAND(100)*100 AS DECIMAL(18,2)),
14                7.5,
15                CAST(RAND(100)*100 AS DECIMAL(18,2)),
16                0,
17                '2012-11-19 00:12:12',
18                '201211191255',
19                '2012-11-19',
20                0,
21                @a+1
22 
23                SET @a=@a+1
24                PRINT @a
25 --               WAITFOR DELAY '00:00:02'  无用
26      END
27     
28 END
29 
30 --清除表数据
31 --用下面这句不用delete,用了delete种子从2开始不知道为什么
32 --TRUNCATE TABLE [dbo].[CT_Dis_FuelingData]
33 
34 --DELETE FROM [dbo].[CT_Dis_FuelingData]
35 ----------------------------------------------------------------------------
36 --USE [Monitoring]
37 --GO
38 ----重置种子值
39 --DBCC CHECKIDENT ([CT_Dis_FuelingData], RESEED, 1)
40 --GO

 

posted @ 2013-08-02 22:59 桦仔 阅读(...) 评论(...)  编辑 收藏