Results 1 to 2 of 2

Thread: stored procedure - please advise

  1. #1
    Join Date
    May 2005
    Posts
    111

    stored procedure - please advise

    i'm trying to set a variable to equal the results set of a stored procedure. please advise me on what is wrong with my "set" statement.

    declare @categoryName varchar(50)
    set @categoryName = 'MAIL - OVERALL'


    DECLARE OUTSIDE_CURS CURSOR FOR

    select uptimeEvent.system_name
    FROM UptimeSystem RIGHT OUTER JOIN
    UptimeEvent ON UptimeSystem.system_name = UptimeEvent.system_name
    where category = @categoryName and type = 1
    group by uptimeEvent.system_name

    FOR READ ONLY

    OPEN OUTSIDE_CURS

    DECLARE @SYSTEM VARCHAR(55)

    FETCH NEXT FROM OUTSIDE_CURS INTO @SYSTEM

    WHILE (@@fetch_status <> -1)

    BEGIN
    IF (@@FETCH_STATUS <> -2)
    BEGIN

    DECLARE @SUBSYSTEM VARCHAR(150)
    SET @SUBSYSTEM = EXEC dbo.sp_PHS_UPTIME_PERC @SYSTEM
    PRINT @SUBSYSTEM

    END
    FETCH NEXT FROM OUTSIDE_CURS INTO @SYSTEM

    END

    CLOSE OUTSIDE_CURS

    DEALLOCATE OUTSIDE_CURS

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Is it on sql server? You can't assign value to variable with exec.

Posting Permissions

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