Object Variable type and expressions

3

I would like to know if there is any way to mount an expression in ssis that returns true or false in a variable of type object:

It would basically be something like in sql 12 in (14,25,45,12,54) but expression instead of a list would be something like

numero in objectVariable 
    
asked by anonymous 17.11.2014 / 16:42

2 answers

2

If you are able to generate the value sequence with commas at the beginning of the end, you can use the CHARINDEX to find the number.

Example:

SELECT *
FROM table
WHERE CHARINDEX( 
        ',54,' , 
        ',14,25,45,12,54,'
    )

Or:

SELECT *
FROM table
WHERE CHARINDEX(
        ',' + CAST(numero as VARCHAR) + ',' , 
        ',14,25,45,12,54,'
    )
    
17.11.2014 / 18:29
2

If it's in SQL Server 2012, you can build a microtable that works as an array:

DECLARE @ListaDeIDs TABLE(IDs int);
INSERT INTO @ListaDeIDs
VALUES(14),(25),(45),(12),(54);
SELECT IDs FROM @ListaDeIDs;
GO

Then the comparison looks like this:

SELECT ...
WHERE 12 IN (SELECT IDs FROM @ListaDeIDs)
    
17.11.2014 / 17:19