首先数据不是从一个表到另一个表的批量导入
CREATEPROCEDUREadd_UserInfo
AS
DECLARE@userCodeVARCHAR(30)
DECLARE@userNameVARCHAR(30)
DECLARE@userCode_baseVARCHAR(30)
DECLARE@countINTEGER
DECLARE@indexINTEGER
DECLARE@rand1INTEGER
DECLARE@rand2INTEGER
SET@userCode_base='qs_'
SET@userName='userName'
SET@count=100000
SET@index=10000
WHILE@index<@count
BEGIN
SET@userCode=@userCode_base+CONVERT(VARCHAR,@index)
SET@rand1=convert(int,rand()*5)
SET@rand2=convert(int,rand()*5)
INSERTINTOuserInfo(userCode,roleType,groupID,userName,text1,text2,text3)
VALUES(@userCode,@rand1,@rand2,@userName,'aokeikaoljof','','aokeikaoljof')
SET@index=@index+1
END
GO
类似上面的代码其中@userCode,@rand1,@rand2,@userName这里的变量不是不变的,是每次插入都不一样,它们的值是从数组获取的