Skip to Content
Former Member
Nov 23, 2011 at 02:50 PM

Using SQL query directly in DI



I have a five long SQL query that extracts columns from 2 tables based on conditions and creates 5 new tables with new columns. The query looks some thing like this:

select a.num_1, b.unid, c.tycod, min(b.csec) - min(a.csec) turnout into


from un_hi a

left join un_hi b on a.num_1 = b.num_1

and ((a.unid = b.unid and left(b.unid,1) not in ('E','Q') and

left(a.unid,1) not in ('E','Q'))

or (right(a.unid,len(a.unid)-1) = right(b.unid,len(b.unid)-1)

and left(b.unid,1) in ('E','Q') and left(a.unid,1) in ('E','Q')))

and b.unit_status = 'ER'

left join aeven c on a.num_1 = c.num_1 and c.rev_num = 1

where a.num_1 like 'F011%' and a.unit_status in ('DP','XE')

group by a.num_1, b.unid, c.tycod;

Is there any way i can directly incorporate the above query in DI and run? The source file is excel sheet and output is SQL server.

Should i use the script in the work flow to execute the query?

Appreciate your inputs.