I have a file name “Sales_20170331”. Now I need to load a fact table from this file. The table has columns Sale_quarter_date, SaleId The sale_quarter_date column is loading from the @FileName variable that I created in ssis. Now I need to create execute sql task in SSIS that will delete the rows in the fact table where sale_quarter_date = @FileName. If quarter_date != @FileName then load those records. The query should look something like
IF EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Facttable]') AND type in (N'U')
AND (SELECT COUNT(*) FROM [dbo].[FactTable]) >0)
DELETE FROM [dbo].[FactTable]
WHERE sale_quarter_date = @FileName
But looks like there is some error here in the query. Can you please help me fix the query and design the execute sql task?
Aucun commentaire:
Enregistrer un commentaire