DECLARE @P_QRY VARCHAR(3000)
SET @P_QRY =''
SET @P_QRY='DECLARE CURSOR_DATA CURSOR FOR SELECT FIELD1 FROM ATABLE '
EXECUTE (@P_QRY)
OPEN CURSOR_DATA
FETCH NEXT CURSOR_DATA
INTO @CO_CD
WHILE @@FETCH_STATUS = 0
BEGIN
UPDATE ~
END --
CLOSE CURSOR_DATA
DEALLOCATE CURSOR_DATA
EXECUTE (@P_QRY) -> could not execute statement
에러나는데 'declare 부터 변수에 담아서 실행할수 있는 방법 없나요?
|