Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Cursors... It is possible to do this?

Author  Topic 

lopes_andre
Starting Member

12 Posts

Posted - 2009-12-02 : 14:38:15
Hi,

I need to use cursors in a way that I don't know if is it possible.

					-- Se for projecto
IF @cID_FAMILIA_TIPO_AV = 'PR'
BEGIN
-- Projectos inseridos dentro de um id_processo_aval
declare proj_processo_aval cursor for
select distinct Substring(CRITERIO, 1, 9) as ID_PROC_PROJ
from M4V_QUALIFIC_AVAL
where ID_SOCIEDAD = 'CG'
and ID_PROCESSO_AVAL = @pid_processo_aval
and ID_QUALIFICACAO = 'ResProj1'
and AUTOAVALIACAO = 'N'
END

-- Se for desempenho semestral
IF @cID_FAMILIA_TIPO_AV = 'DS'
BEGIN
-- Projectos inseridos dentro de um id_processo_aval
declare proj_processo_aval cursor for

END



-- Definição das inicializações do cursor projecto
IF @cID_FAMILIA_TIPO_AV = 'PR'
BEGIN
set @nome_cursor2 = 'proj_processo_aval'
set @variaveis_cursor2 = '@c2ID_PROC_PROJ'
END

-- Definição das inicializações do cursor desempenho semestral
IF @cID_FAMILIA_TIPO_AV = 'DS'
BEGIN
set @nome_cursor2 = ''
set @variaveis_cursor2 = ''
END



OPEN @nome_cursor2
FETCH @nome_cursor2 INTO @variaveis_cursor2


WHILE (@@FETCH_STATUS=0)

BEGIN

return 0


FETCH @nome_cursor2 INTO @variaveis_cursor2
END;

CLOSE @nome_cursor2
DEALLOCATE @nome_cursor2


I'am trying to do this, but gives me an error.

quote:
The variable '@nome_cursor2' is not a cursor variable, but it is used in a place where a cursor variable is expected.


How can I solve this problem?


Best Regards,
André.

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-12-02 : 15:18:46
see the following it is possible.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135108

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -