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

sql query changes when pasted in the dataflow task OLEDB SOurce using the sql command

$
0
0

Hi All,

 I am using temp tables in my sql command and it works fine in SSMS , when i copy paste it into the SSIS DFT , the sql is changed. Please see the below codes , the first one is the original which runs fine in SSMS and the second one is in the SSIS. Please help as why and how its getting changed.

declare @SnapshotDate datetime2 = '20180425';
declare @StartDate datetime2;
declare @EndDate datetime2;

set @StartDate = @SnapshotDate
     set @EndDate   = dateadd(ns, -100, dateadd(day, 1, @SnapshotDate));
IF OBJECT_ID('TEMPDB.dbo.#financial_records') IS NOT NULL DROP TABLE #financial_records
select f.Src_id
     , f.create_date
     , f.floorplan_id
     , f.fee_type_id
     , f.amount_applied
     , f.responsible_business_id
     , f.currency_id
     , f.financial_record_type_id
into #financial_records
from dbo.revenue f
where create_date
between @StartDate and @EndDate;

select *
from  #financial_records


DECLARE ? datetime2 = '20180425'; DECLARE ? datetime2; DECLARE ? datetime2;
SET       ? = ?
SET       ? = dateadd(ns, - 100, dateadd(day, 1, ?)); IF OBJECT_ID('TEMPDB.dbo.#financial_records') IS NOT NULL DROP TABLE #financial_records
                 SELECT f.Src_id, f.create_date, f.floorplan_id, f.fee_type_id, f.amount_applied, f.responsible_business_id, f.currency_id, f.financial_record_type_id
                INTO     #financial_records
                FROM    dbo.revenue f
                WHERE create_date BETWEEN ? AND ?;
                                 SELECT *
                                FROM    #financial_records

error message

Thanks

Lisa


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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