sqlserver 中while循环语句的书写格式

--声明变量;
DECLARE @i int
DECLARE @username varchar(30)
DECLARE @password varchar(30)
Set @i = 1000

--开始 循环 插入数据;
WHILE @i < 1000
BEGIN
Set @i =@i +1
SET @username = RIGHT('00000' + CAST(@i AS varchar(30)),5) 
set @password = @name
insert into admin values(@name,@password)
END

你可能感兴趣的:(数据库,sqlserver,sql,function)