CASE statement with get date

Viewed 199

I get a file with todays date but sometimes this can sent through to me past midnight so it would be tomorrow between 00:00 and 03:00, Would a case statement work? If so can u help me with the code as I'm new to all of this. I think the case statement would need if it comes through between 00:00 and 03:00 it does getdate -1.

Using SSIS I get the package to read getdate() as a variable and thats how it knows what the file reads at. Any help is appreciated

1 Answers

to apply in ssis,

An execute sql task will able trigger reading the file(s) on your folder based on the current date.

select case when getdate() between cast(getdate() as date) and dateadd(ss, 30, cast(cast(getdate() + 1 as date) as datetime)) then 1 else 0 end

Related