Four Stars

sql temp tables in tmssqlinput

I am running a query on a mssql db. The query runs perfectly fine in microsoft sql server management studio. However, the query will not run in talend. I cannot share the code but below is the general flow of the code. 

BEGIN

DECLARE A FEW VARIABLES

 

SELECT INTO TEMP TABLE1

SELECT INTO TEMP TABLE2

 

run queries

 

drop temp tables 

 

Could someone please demonstrate the proper way to do this sort of query in talend?

5 REPLIES
Twelve Stars

Re: sql temp tables in tmssqlinput


Robert_gill wrote:

I am running a query on a mssql db. The query runs perfectly fine in microsoft sql server management studio. However, the query will not run in talend. I cannot share the code but below is the general flow of the code. 

BEGIN

DECLARE A FEW VARIABLES

 

SELECT INTO TEMP TABLE1

SELECT INTO TEMP TABLE2

 

run queries

 

drop temp tables 

 

Could someone please demonstrate the proper way to do this sort of query in talend?


"BEGIN
          DECLARE A FEW VARIABLES;
 
          SELECT INTO TEMP TABLE1;
          SELECT INTO TEMP TABLE2;
 
          run queries;
 
          drop temp tables ;

END"

 

 

-----------
Four Stars

Re: sql temp tables in tmssqlinput

That is how I had my code initially. If I use ";" talend throws syntax errors and if I don't use ";" the query begins to run then stops without displaying any sort of message. 

Twelve Stars

Re: sql temp tables in tmssqlinput

look,

I can try to guess - what are do wrong Smiley Wink ... but do I need this?

 

what I know, my code - is work Smiley Happy

I have my own code - it work

I create code similar to describe in Your pseudo code - it work

 

why all must guess - what also You are forget include :-)

 

Code:
Screen Shot 2018-02-15 at 2.59.51 PM.png

Result:

Screen Shot 2018-02-15 at 3.00.06 PM.png

-----------
Four Stars

Re: sql temp tables in tmssqlinput

It is weird, the query results do not appear when i test the query.
However, talend can guess the schema and pull the data
Twelve Stars

Re: sql temp tables in tmssqlinput

tSQLRow - do not proper component for return result (even in combination with)
Use tMSSQLInput instead

 

 

Screen Shot 2018-02-15 at 3.11.56 PM.pngScreen Shot 2018-02-15 at 3.12.20 PM.png

-----------