이것은 바보 같은 구문 오류 일 수 있지만 계속 프로 시저를 읽지 만 내 오류가 어디에 있는지 알 수 없습니다.SQL 서버의 구문 오류
내 코드?메시지 156, 수준 15, 상태 1, 줄 '을위한'키워드 근처 41
이
의 구문이 잘못되었습니다.alter procedure LockReservation as DECLARE @edition_id tinyint, @stockid tinyint; DECLARE @creservation CURSOR FOR select edition_id from reservation where (date_fin - GETUTCDATE()) <= 12; open creservation; while @@fetch_status = 0 BEGIN fetch creservation into @edition_id; DECLARE @cstock CURSOR FOR select id from stock where edition_id = @edition_id; open cstock; while @@fetch_status = 0 BEGIN fetch cstock into @stockid; select stock_id from location where location.stock_id = @stockid and archivage = 0 if @@rowcount = 0 BEGIN insert into stocks_reserves(id, date_ajout, usure, suppression, edition_id) Select id, date_ajout, usure, suppression, edition_id from stock where stock.id = @stockid END END CLOSE cstock DEALLOCATE cstock END CLOSE creservation DEALLOCATE creservation
누군가가 나를 도울 수 있습니다 : 여기
에서 커서 이름 앞에
@
심볼의 커서의 creservation? –이 접근법에 대해 저축을 선언하는 행은 – Dimitri