Comments (2)
Hi Pál,
I'm glad to hear it!
To test, you can look for GUIDs outside your expected date range:
SELECT * FROM myTable WHERE
guid < SELECT CAST(
CAST(DATEDIFF_BIG(MILLISECOND, '1970-1-1', '2015-01-22') AS BINARY(16))
AS UNIQUEIDENTIFIER)
OR guid > SET @startGuid = SELECT CAST(
CAST(DATEDIFF_BIG(MILLISECOND, '1970-1-1', GETUTCDATE()) AS BINARY(16))
AS UNIQUEIDENTIFIER);
The above code assumes that you started using COMBs on 2015-01-22 and that you are using the UnixTimeStampStrategy
with SqlCombProvider
on MSSQL 2016+ or Azure DB. The same approach can be used with the other strategies or database platforms.
This is not foolproof -- there is a small but real chance that a random non-COMB GUID may have a "valid" COMB date/time. If you have other data you can compare to -- for example, an audit log of when the record was inserted -- you could look for a smaller valid date range.
I'm looking at doing the same thing with some legacy data. In my case, the GUIDs were created using the original SqlDateTimeStrategy
and I've now standardized my code to use the UnixTimeStampStrategy
. So in my case I'll be looking for GUIDs outside the acceptable Unix date range but within the SQL DateTime range, extracting the timestamp, and re-creating the equivalent Unix timestamp GUID. I haven't written the code for that yet, but it'll be similar to the above. Fortunately, none of the GUIDs in my case are used as foreign keys, so this should be a fairly simple process.
from rt.comb.
Hi Richard,
thanks for the check code, info!
from rt.comb.
Related Issues (20)
- Migrating from SQL Server to PostgreSQL with COMB guids HOT 2
- Comparing two Guid (created with RT.Comb) if lower HOT 1
- Binary order for PostgreSql and Sqlite what Provider or Strategy to use. HOT 6
- Installing NuGet package pulls in lots of unwanted "dependencies" HOT 2
- Generate Guid for a specific DateTime (i.e. not for Now) HOT 1
- deploy into SQL Server HOT 2
- Create AspNetCore package HOT 5
- RT.Comb.Provider.Postgre.Create().ToString("N") JavaScript version. HOT 1
- PostgreSqlCombProvider not sequential in Postgresql HOT 2
- MySql Support HOT 2
- Full comb from timestamp HOT 1
- Question about existing SQL Server Tables HOT 1
- M.E.DependencyInjection v7.0 potentially breaks .NET 6.0 apps/sites HOT 1
- Querying records via the COMB timestamp HOT 1
- Generate the smallest/bigest COMB for a date in C#
- Suggestion for T-SQL query to use SYSUTCDATETIME() instead of GETUTCDATE() HOT 1
- How to user UtcNoRepeatTimestampProvider when using asp.net AddSqlCombGuidWithUnixDateTime()
- references non-optimized RT.Comb ??? HOT 1
- test result show not sorted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rt.comb.