Within a Stream Analytics query, I'm trying to convert a date to a simple ISO 8601 date-only format, like so:
CONCAT(
c.IoTHub.ConnectionDeviceId,
'@',
CAST(DATEPART(year, EventProcessedUtcTime) as nvarchar(max)),
'-',
CAST(DATEPART(month, EventProcessedUtcTime) as nvarchar(max)),
'-',
CAST(DATEPART(day, EventProcessedUtcTime) as nvarchar(max))
) as partitionkey
This works alright, but it produces dates like so:
2017-3-5
I'd prefer that the dates be lead-zero-padded, like this:
2017-03-05
This is a simple thing in T-Sql, but I don't see any of the tools necessary to make this or any of the other tricks work to be present in the SA query language subset.
Anybody know a way to tackle this?