How to get in U-SQL:
If I was using SQL I would write the following query (any idea how to write it in U-SQL?):
WHERE MyDate BETWEEN DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-1, 0) AND DATEADD(MONTH, DATEDIFF(MONTH, 0, getdate()), 0)
You can use C# expressions for that:
DECLARE @startDayThisMonth DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
DECLARE @startDayPreviousMonth DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 1);
@data =
SELECT
x
FROM
y
WHERE
MyDate BETWEEN @startDate AND @endDate;
Examples can be found at this site.