Azure-docs: How to SplitMerge by DateTime

Created on 27 Nov 2019  Â·  7Comments  Â·  Source: MicrosoftDocs/azure-docs

I'm trying this : articles/sql-database/sql-database-elastic-scale-configure-deploy-split-and-merge.md

Experiment with other data types!
All of these scripts take an optional -ShardKeyType parameter that allows you to specify the key type.
The default is Int32, but you can also specify Int64, Guid, or Binary.

Can I use also DateTime ?
What should I enter to the [Split at Key] form ?

Trying "2010-07-01", then an ArgumentException is shown.

"40358" is same result.
(40358 is calculated by SELECT Convert(float, CONVERT(datetime, '2010/07/01')))

image
image

"0x88CCE6C77BA9C000" resulted in the other exception.
(configured in [__ShardManagement].[ShardMappingsGlobal].[MaxValue])

Status: Failed
Details: [Error] Failed to process request.
Microsoft.Azure.SqlDatabase.ElasticScale.SplitMerge.Worker.InvalidSplitMergeOperationException:
The specified shard map 'xxxxx' with key type Binary could not be found.
---> Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ShardManagementException:
Shard map 'xxxxx' can not be converted to the target type RangeShardMap Its actual type is RangeShardMap<DateTime>.

Finally I left it blank.
but the exception sais "The field 'Split Key' is mandatory and cannot be left blank".

What should I do?
Regards, thank you.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author product-question scale-ousubsvc sql-databassvc triaged

All 7 comments

Thank you for reaching out.
We are actively investigating and will get back to you soon.

@mijp The ShardKey expects a datetime as documented here
Could you please try providing the value in this format

2019-12-01 22:17:28.920

@stevestein Could you please evaluate if the shardkey format needs to be documented with examples?

@KalyanChanumolu-MSFT
Thank you for your reply.

It does n’t work.
Are there other problems?

image

image

@mijp - thanks for the feedback!

I haven't tested this, and I'd need to find someone with knowledge of the split-merge tool, but based on the error message I'd probably experiment with trying to pass the date as a binary key that the exception info is indicating. I'm not sure about converting dates to binary values, but maybe something like this will help get past the exception:

DECLARE @dt DateTime
SET @dt = '12/31/2019'
SELECT CONVERT(binary, @dt,1)

@stevestein
Thank you for your reply.
I thought there was no information, so deleted the app-service and databases. (because not free..)
I will try again later.

Thanks

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Favna picture Favna  Â·  3Comments

Agazoth picture Agazoth  Â·  3Comments

bityob picture bityob  Â·  3Comments

bdcoder2 picture bdcoder2  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments