Datetime conversion issue in SSIS
i have created variable begin_tmstp datetime datatype
further, have created 2 execute sql task.
execute sql task 1:
select sysdate begin_tmstp dual
and in result set im mapping like result name variable name
begin_tmstp user::begin_tmstp
execute sql task 2:
insert batch_job_log(job_name,begin_tmstp)values(?,?)
mapping looks like:
system::packagename varchar
user::begin_tmstp date
until now, inserting correct date , time.
i want use query variable giving me conversion error:the data types "dt_wstr" , "dt_date" incompatible binary operator "+". operand types not implicitly cast compatible types operation. perform operation, 1 or both operands need explicitly cast cast operator.
the query avariable looks follow:
"select name,address from table1 , table 2 a.code = b.code , b.txnmy_last_change_tmstp> (select max(begin_tmstp)from lbs_stage.batch_job_log)
, b.txnmy_last_change_tmstp< ('"+ @[user::begin_tmstp] +"','yyyymmddhh24miss')"
please advice.
sorry harry
if understand have execute sql task 1 populating variable user::begin_tmstp, @ moment string using tochar(sysdate,'yyyymmddhh24miss')
you have adapted/disabled execute sql task 2 work past variable string
and third task has query based on variable
"select name,address from table1 , table 2 a.code = b.code , b.txnmy_last_change_tmstp> (select max(begin_tmstp)from lbs_stage.batch_job_log)
, b.txnmy_last_change_tmstp< to_date('"+ @[user::begin_tmstp] +"','yyyymmddhh24miss')"
it appears fine unless else can point out fault :(
best wishes, redman; if helps, please show voting, if solves, bonus!
SQL Server > SQL Server Integration Services
Comments
Post a Comment