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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only one SELECT to retrive data into output variables

Status
Not open for further replies.

edgarasm

Programmer
Oct 29, 2002
26
BR
I would like to know whether or not there is a way to execute an unique SELECT and get the results into the respective output variables I have created?

Code:
PROCEDURE [DETALHES_DIVULGADO] 
@ID_DIV INT,
@TURMA_FK SMALLINT OUTPUT,
@PERIODO_FK INT OUTPUT,
@PROFESSOR VARCHAR(60) OUTPUT,
@MONITORES VARCHAR(200) OUTPUT,
@VAGAS SMALLINT OUTPUT,
@MINVAGAS TINYINT OUTPUT,
@VLRCOMVINC SMALLMONEY OUTPUT,
@VLRSEMVINC SMALLMONEY OUTPUT,
@VLRESPECIAL SMALLMONEY OUTPUT,
@HORARIO VARCHAR(255) OUTPUT,
@LOCALIZACAO VARCHAR(255) OUTPUT,
@CONTATO VARCHAR(100) OUTPUT,
@OBS VARCHAR(255) OUTPUT,
@TIPO CHAR(1) OUTPUT,
@TEXTOEXCECAO VARCHAR(500) OUTPUT,
@DTINIINSC DATETIME OUTPUT,
@DTFIMINSC DATETIME OUTPUT
AS

is there a way?

for examplo:

SELECT @TURMA_FK, @PERIODO, ...??? = (SELECT TURMA_FK, PERIODO_FK, PROFESSOR, MONITORES, VAGAS, 
MINVAGAS, VLRCOMVINC, VLRSEMVINC, VLRESPECIAL, HORARIO,LOCALIZACAO, CONTATO, OBS, TIPO, TEXTOEXCECAO,	 DTINIINSC, DTFIMINSC FROM DIVULGADO WHERE ID_DIV=@ID_DIV ) 

...
 
..


select @var1 = FIELD1,
@var2 = FIELD2,
@var3 = FIELD3
from mytable
where ...

The clause where must return one row.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top