Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Is derived column the right choice ?

$
0
0

Hi,

I'm not sure if a derived column is the right choice in this case but this is what I am trying at the moment.

I've got a data set incoming from a flat file source.


In the derived column im trying to calculate a average and inserting it into a new column before its being inserted to the main table.


This is the expression I've build

"SELECT AVG([Adj Close]) FROM StockPrices where [Symbol] = " + @[User::TickerSymbol] + "AND [Date] <= " (DT_WSTR,10)Date + " AND [Date] >= DATEADD(MONTH,-1, " + (DT_WSTR,10)Date + " )"


This is an example of a query the provides the output im looking for

SELECT AVG([Adj Close]) FROM StockPrices where [Symbol] = 'CARL-B.CO'
AND [Date] <= '2012-11-02' AND [Date] >= DATEADD(MONTH,-1, '2012-11-02' )

I want the symbol and the dates to change due to the actual rows being processed.

Any support will be appreciated



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>