T-sql 遍历结果集

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 遍历结果集,布布扣,bubuko.com

T-sql 遍历结果集

上一篇:Oracle事务隔离级别


下一篇:EF4.1DbContext使用现成的数据库