数据库插入并选择问题

时间:2015-03-22 14:34:09

标签: sql-server-2008 sql-server-2012

为什么我发现很难在表中插入超过7个值? 当我选择它时,只检索7个值

1 个答案:

答案 0 :(得分:0)

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED IF OBJECT_ID('dbo.TABLE1') IS NOT NULL DROP TABLE dbo.TABLE1 CREATE TABLE dbo.TABLE1 (ACC_ID INT IDENTITY(1,1) NOT NULL ,DT SMALLDATETIME ,DR NUMERIC(20,4) ,CR NUMERIC(20,4) PRIMARY KEY (ACC_ID,DT)) DECLARE @VAR INT = 0 WHILE @VAR < 100 BEGIN INSERT INTO dbo.TABLE1(DT,DR,CR) SELECT '2014-01-05',20+@VAR^2,@VAR + 100 SET @VAR = @VAR + 1 END