sql 存储过程 游标循环
发布网友
发布时间:2022-04-08 03:22
我来回答
共1个回答
热心网友
时间:2022-04-08 04:52
SET @SQL='
DECLARE @INSTALL 类型
DECLARE EMPLOYEE_CLASS CURSOR FOR
SELECT INSTALL '+@TABLENAME
SET @SQL=@SQL+'
OPEN EMPLOYEE_CLASS
FETCH NEXT FROM EMPLOYEE_CLASS INTO @INSTALL
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM EMPLOYEE_CLASS INTO @INSTALL
END
CLOSE EMPLOYEE_CLASS
DEALLOCATE EMPLOYEE_CLASS
RETURN
'
EXEC (@SQL)追问能说下思路吗