Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on Stored Procedure

Status
Not open for further replies.

vaidyanathanpc

Programmer
Nov 30, 2001
36
0
0
IN
CREATE PROCEDURE CreateMenuItems

@in_cls_id int


AS
declare .....

DECLARE cursor_name CURSOR FOR
SELECT DISTINCT column1,column1,column3 ....
FROM viewUserPrivileges
WHERE .....
ORDER BY .....

OPEN cursor_name

FETCH NEXT FROM cursor_name
INTO declared local variables

while @@FETCH_STATUS <> -1
begin

if <condition>
begin
Print 'null'
insert into table....
Execute CreateMenuItems @in_cls_id
end
else
insert into table...
Print 'Not null'
FETCH NEXT FROM cls_cursor
INTO declared local variables
End
close cursor_name
deallocate cursor_name


In the above procedure CreateMenuItems
calls itself. Is this possible? If not is there any other way to achieve the same?

Thanks in advance
P.C. Vaidyanathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top