用于限制记录的SQL查询

时间:2017-03-08 22:10:17

标签: sql sql-server ssis

我在数据流,SSIS包的控制流程中有以下SQL查询,我想通过切断点限制记录,并且切断点是系统的当前日期/日期。所以,它应该只显示过去的记录,不包括今天的记录。所以,我认为我需要使用特定字段(这是日期字段 - 在查询中称为'FinalCloseDate'并与当前系统日期进行比较,并告诉它仅提取之前发生的记录(可能是<今天的日期)今天或当前的系统日。

1 个答案:

答案 0 :(得分:2)

添加

@Bean
@InboundChannelAdapter(value = "dailyFileInputChannel", poller = @Poller(maxMessagesPerPoll = "1", fixedDelay = "${load.manualPollingInterval}"))
public MessageSource<File> messageSource(ApplicationProperties applicationProperties) {
     FileReadingMessageSource source = new FileReadingMessageSource();
     source.setDirectory(applicationProperties.getLoadDirectory());
     CompositeFileListFilter<File> compositeFileListFilter = new CompositeFileListFilter<File>();
     compositeFileListFilter.addFilter(new LastModifiedFileListFilter());
     FileSystemPersistentAcceptOnceFileListFilter persistent = new FileSystemPersistentAcceptOnceFileListFilter(store(), "dailyfilesystem");
     persistent.setFlushOnUpdate(true);
     compositeFileListFilter.addFilter(persistent);
     compositeFileListFilter.addFilter(new SimplePatternFileListFilter(applicationProperties.getFileNamePattern()));
     source.setFilter(compositeFileListFilter);
     return source;
}

@Bean
public PropertiesPersistingMetadataStore store() {
    PropertiesPersistingMetadataStore store = new PropertiesPersistingMetadataStore();
    store.setBaseDirectory(applicationProperties.getProcessedStoreDirectory());
    store.setFileName(applicationProperties.getProcessedStoreFile());
    return store;
}

@Bean
@ServiceActivator(inputChannel = "dailyFileInputChannel")
public MessageHandler handler() {
    // return a handler that processes and moves the file
}

到你的AND dbo.Producthit.FinalCloseDate < CAST(GETDATE() AS DATE) 条款。