1

I need to do something like this in SSIS:

From one SQL table I need to get some id values, I am using a simple sql query:

Select ID from Identifier where value is not null.

I've got this result:

enter image description here

As a final result I need to generate and set a variable in SSIS with the final value:

@var = '198','120','ACP','120','PQU'

Which I need to use later in a odbc expression.

Is this possible in SSIS?

Just to clarify: The image is just a little example of what I can get from the first part of the process. I mean, the number of ID that I need is unknown.

Community
  • 1
  • 1
d2907
  • 798
  • 3
  • 15
  • 45
  • 1
    Yes, use an EXECUTE SQL task and a SQL command that uses FOR XML to concatenate the output. – Tab Alleman May 11 '15 at 15:56
  • Man, any example?, I mean , I'm kind of new in this. Is there a page or a site where I can see the steps?. Thanks for your reply. – d2907 May 11 '15 at 17:37

1 Answers1

0

Use simple query

DECLARE @TEST TABLE(ID NVARCHAR(10))
INSERT INTO @TEST VALUES('186'), ('120'), ('ACP'), ('120'), ('PQU')

DECLARE @ID VARCHAR(8000) 
SELECT @ID = CONCAT(COALESCE(@ID + ',''', ''''), ID, '''')
FROM @TEST

SELECT @ID

Result

'186','120','ACP','120','PQU'
Ray Krungkaew
  • 6,652
  • 1
  • 17
  • 28
  • Thanks for your reply. But the number of Id is variable. It depends on the first part of the process. – d2907 May 12 '15 at 22:40