DECLARE @TAB TABLE( [科室编号] [varchar](50) NULL, [科室编码] [varchar](50) NULL, [科室名称] [varchar](50) NULL, [拼音] [varchar](50) NULL ) INSERT INTO @TAB SELECT * FROM Table_uvi_dept SELECT * FROM @TAB WHILE((SELECT COUNT([科室编号]) FROM @TAB)>0) BEGIN PRINT 1 DELETE @TAB WHERE [科室编号]=(SELECT TOP 1 [科室编号] from @TAB) END
T-sql 遍历结果集
时间: 2024-10-13 16:11:08