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

Need to get the Date columns into the SQL expression to use it in OLE DB source (SQL Command with variable)

$
0
0

Hi,

I am trying to create a variable as a string in my package, and put the following SQL command into that variable as a expression. I am only facing issues when I need to include the date columns in my query, I am not sure how to cast them, before using them in the expression. I have Effective and Expire date columns in my SQL query.

SELECT
    A.CUST_ID, A.CUST_LEG_NM, C.CNFG_ID, C.CNFG_NM, B.CUST_CNFG_EFF_DT, B.CUST_CNFG_EXPIR_DT, B.CREAT_TS, B.UPDT_TS, B.UPDT_BY
FROM espMB.CUST A
INNER JOIN espMB.CUST_CNFG B ON A.CUST_ID = B.CUST_ID
INNER JOIN espMB.CNFG C ON B.CNFG_ID = C.CNFG_ID
WHERE A.CUST_ID IN (137113)
ORDER BY  B.CUST_CNFG_EXPIR_DT;

As mentioned in the query, there are 4 columns which I have as dates, B.CUST_CNFG_EFF_DT, B.CUST_CNFG_EXPIR_DT, B.CREAT_TS, B.UPDT_TS. If I remove these columns, I am able to use that variable in the source. But, if I include them I am getting issues.

Can anyone help me in putting this SQL query in an expression way.


Rahul



Viewing all articles
Browse latest Browse all 24688

Trending Articles



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