SQL Server2008R2循环语句
时间:2021-07-01 10:21:17
帮助过:18人阅读
清空表的所有数据内容
declare @i nvarchar(36),@j nvarchar(
36),@k nvarchar(
36),@n nvarchar(
36)
declare @LOCNUM nvarchar(36),@OBJECTTYPE nvarchar(
36),@LOCDESC nvarchar(
60),@LOCSTATUS nvarchar(
36),@LOCSTORESTATUS nvarchar(
36),@LINE
decimal(
5,
0),@LIE
decimal(
5,
0),@LAYER
decimal(
5,
0)
set @i=
1
set @n=
101
while @i<
33
begin
set @j=
13
while @j<
31
begin
set @k=
1
while @k<
3
begin
set @LOCNUM=
‘OME01_00113303200‘+
@n
set @OBJECTTYPE=
‘TBuff‘
set @LOCDESC=
‘1巷道‘+@i+
‘行‘+@j+
‘列‘+@k+
‘层‘
set @LOCSTATUS=
‘Normal‘
set @LOCSTORESTATUS=
‘Free‘
set @LINE=
@i
set @LIE=
@j
set @LAYER=
@k
INSERT INTO [WMSServer].[dbo].[TWMS_LOC]
([LOCNUM]
,[OBJECTTYPE]
,[LOCDESC]
,[LOCSTATUS]
,[LOCSTORESTATUS]
,[LINE]
,[LIE]
,[LAYER])
VALUES
(@LOCNUM
,@OBJECTTYPE
,@LOCDESC
,@LOCSTATUS
,@LOCSTORESTATUS
,@LINE
,@LIE
,@LAYER)
set @k=@k+
1
end
set @j=@j+
1
end
set @i=@i+
1
end
GO
View Code
SQL Server2008R2循环语句
标签:table res int hide 图片 truncate isp 循环语句 lin