<%
' Helpful script for rendering SQL to do CURSOR work.
%>
<% if Request.Form.Count > 0 then %>
<pre>
DECLARE <% = Request.Form("cursorName") %> CURSOR LOCAL FORWARD_ONLY
READ_ONLY FOR
-- Add SQL.
OPEN <% = Request.Form("cursorName") %>
DECLARE @<% = Request.Form("varName") %> int
FETCH NEXT FROM <%=Request.Form("cursorName")%> INTO @<%=Request.Form("varName")%>
WHILE @@FETCH_STATUS = 0
BEGIN
-- Add code.
FETCH NEXT FROM <%=Request.Form("cursorName")%> INTO @<%=Request.Form("varName")%>
END
CLOSE <% = Request.Form("cursorName") %>
DEALLOCATE <% = Request.Form("cursorName") %>
</pre>
<% end if %>
<br>
<form method=post>
Cursor Name:
<input name=cursorName value="<% = Request.Form("cursorName") %>">
Var Name:
<input name=varName value="<% = Request.Form("varName") %>">
<input type=submit>
</form>
|