sqlserver循环语句(sqlserver循环语句 查询)

sqlserver循环语句(sqlserver循环语句 查询)p 1 普通循环 p Create table WS Student Id int primary key not null My Cocode int My SCocode int userId bigint SetCName varchar NULL SetEName varchar NULL

大家好,我是讯享网,很高兴认识大家。



 <p>1.普通循环</p> 

讯享网


讯享网

Create table WS_Student
(
      [Id] int primary key not null,
    [My_Cocode] [int],
    [My_SCocode] [int],
    [userId] [bigint],
    [SetCName] varchar NULL,
    [SetEName] varchar NULL,
    [SetPcode] varchar NULL,
    [SetScode] varchar NULL,
    [SetValue] varchar NULL,
    [SetSql] varchar NULL,
    [Sort] [Int] NULL,
    [IsTurnOn] [bit] NULL,
    [IsSystem] [bit] NULL,
    [Remarks] varchar NULL,
    [CreatedUserId] [bigint] NULL,
    [CreatedUserName] varchar NULL,
    [CreatedTime] [datetime] NULL,
    [UpdatedUserId] [bigint] NULL,
    [UpdatedUserName] varchar NULL,
    [UpdatedTime] [datetime] NULL,
    [IsDeleted] [bit] NULL
)
INSERT INTO WS_Student VALUES(1,,,0,‘是否学生’,‘是否学生’,‘WS_Student’,
‘WS_Student_IsStudent’,‘1’,null,1,1,1,‘是否学生’,,‘shil’,GETDATE(),,‘shil’,GETDATE(),0)
























–循环5次来新增学生表信息

–循环遍历修改记录–
declare @i int  
set @i=7
while @i&lt;9
begin
    INSERT INTO WS_Student VALUES((@i,,,0,‘是否学生’,‘是否学生’,‘WS_Student’,
‘WS_Student_IsStudent’,‘1’,null,1,1,1,‘是否学生’,,‘shil’,GETDATE(),,‘shil’,GETDATE(),0)
    set @i=@i +1
end
–查看结果–
select * from WS_Student










小讯
上一篇 2025-05-24 21:44
下一篇 2025-05-18 11:03

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/170485.html