SQLServer,批量插入数据

#表名:tablename

#字段:account_id ,question ,answer ,lang 

#start

CREATE PROCEDURE add_tablename_7

AS
DECLARE @account_id INTEGER
DECLARE @question VARCHAR
DECLARE @answer VARCHAR
DECLARE @lang INTEGER
DECLARE @index INTEGER
DECLARE @count INTEGER
SET @account_id= 3913827
SET @question='question'
SET @answer='answer'
SET @lang=1
SET @count=1001
SET @index=1
WHILE @index<@count
BEGIN
INSERT INTO tablename(account_id,question,answer,lang)
 VALUES (@account_id,@question,@answer,@lang)
 SET @index=@index+1
END

GO

#exec

exec add_tablename_7

INTEGER 不支持java long型,会溢出

发布了49 篇原创文章 · 获赞 6 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/cc007cc009/article/details/79215215