EXEMPLO_1212310
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
FUNC_GETPARAM_TABLEINT
Parameters
Name
Type
Mode
@NOME_PARAMETRO
varchar
IN
Definition
CREATE FUNCTION FUNC_GETPARAM_TABLEINT (@NOME_PARAMETRO VARCHAR(MAX)) RETURNS @CURSOR_PARAMETRO TABLE ( COLIGADA INT, ID INT) AS BEGIN DECLARE @COLIGADA INT DECLARE @VALOR_PARAMETRO VARCHAR(MAX) DECLARE @ID INT DECLARE COLIGADAS CURSOR FOR SELECT HCPARAMETROS.CODCOLIGADA, HCPARAMETROS.VALORINT FROM HCPARAMETROS (NOLOCK) WHERE ( HCPARAMETROS.CODCOLIGADA <> 0 AND HCPARAMETROS.NOMECOLUNA = @NOME_PARAMETRO ) AND HCPARAMETROS.VALORINT IS NOT NULL OPEN COLIGADAS FETCH NEXT FROM COLIGADAS INTO @COLIGADA, @VALOR_PARAMETRO WHILE @@FETCH_STATUS = 0 BEGIN DECLARE CURSOR_PARAMETRO CURSOR FOR SELECT ITEM FROM SPLITSTRINGS(@VALOR_PARAMETRO, ';') OPEN CURSOR_PARAMETRO FETCH NEXT FROM CURSOR_PARAMETRO INTO @ID WHILE @@FETCH_STATUS = 0 BEGIN INSERT INTO @CURSOR_PARAMETRO SELECT @COLIGADA, @ID FETCH NEXT FROM CURSOR_PARAMETRO INTO @ID END CLOSE CURSOR_PARAMETRO DEALLOCATE CURSOR_PARAMETRO FETCH NEXT FROM COLIGADAS INTO @COLIGADA, @VALOR_PARAMETRO END CLOSE COLIGADAS DEALLOCATE COLIGADAS RETURN END