Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Posts
    28

    Unanswered: Help on Stored Procedure

    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. VaidyanathanExecute CreateMenuItems @in_cls_id

  2. #2
    Join Date
    Feb 2002
    Posts
    15
    If it called itself, you would have an endless loop.

    Not a good thing - I would not do it.

    J.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •