Javascript GUID

If you need a GUID in Javascript, here are samples for building your own, either in a browser setting, or using NodeJS where you can easily add more features. In Browser: function createGuid() { return “xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx”.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c == “x” ? r : […]

SQL Server GUID as Primary Key

There are a few use cases for using a GUID as a primary key on a table. If you fall into one of those categories, make sure you are optimizing storage by properly defining an incrementing clustered index. You can solve some problems by using NEWSEQUENTIALID() to generate your key, but that actually can make […]

.NET Guid Formats

GUIDs can be a quick (but not secure) way to generate random values in .NET. You can use them in UNIQUEIDENTIFIER columns in SQL Server or the equivalent data type in other database systems. The framework gives you a few formatting options, depending on what you need it for. See the documentation for more about […]