guid

SCOPE_IDENTITY() for GUIDs?

徘徊边缘 提交于 2019-11-26 18:40:00
Can anyone tell me if there is an equivalent of SCOPE_IDENTITY() when using GUIDs as a primary key in SQL Server? I don't want to create the GUID first and save as a variable as we're using sequential GUIDs as our primary keys. Any idea on what the best way to retrieve the last inserted GUID primary key? You can get the GUID back by using OUTPUT. This works when you're inserting multiple records also. CREATE TABLE dbo.GuidPk ( ColGuid uniqueidentifier NOT NULL DEFAULT NewSequentialID(), Col2 int NOT NULL ) GO DECLARE @op TABLE ( ColGuid uniqueidentifier ) INSERT INTO dbo.GuidPk ( Col2 ) OUTPUT

Sequential Guid Generator

徘徊边缘 提交于 2019-11-26 18:31:50
Is there any way to get the functionality of the Sql Server 2005+ Sequential Guid generator without inserting records to read it back on round trip or invoking a native win dll call? I saw someone answer with a way of using rpcrt4.dll but I'm not sure if that would be able to work from my hosted environment for production. Edit: Working with @John Boker's answer I attempted to turn it into more of a GuidComb generator instead of being dependent on the last generated Guid other than starting over. That for the seed instead of starting with Guid.Empty that I use public SequentialGuid() { var

Why is “GUID” used in SAP CRM?

只愿长相守 提交于 2019-11-26 18:19:29
One consultant from customer who has rich experience in ERP SD/MM module asked me a question some time ago. why GUID is used in SAP CRM, instead of using <product id>/<business partner id> directly? Because in R/3, ECC or ERP solution, GUID is not introduced. One exception might be the business partners (not customer/vendor/consumer, but business partner like in CRM), if you activate the business partner functionality in ERP, you could also find BP GUID in table BUT000. Going back to the original question, this time I did some research and now am going to provide an answer which makes sense to

Collision probability of ObjectId vs UUID in a large distributed system

那年仲夏 提交于 2019-11-26 17:45:06
问题 Considering that an UUID rfc 4122 (16 bytes) is much larger than a MongoDB ObjectId (12 bytes), I am trying to find out how their collision probability compare. I know that is something around quite unlikely , but in my case most ids will be generated within a large number of mobile clients, not within a limited set of servers. I wonder if in this case, there is a justified concern . Compared to the normal case where all ids are generated by a small number of clients: It might take months to

带进度条的文件批量上传插件uploadify

爱⌒轻易说出口 提交于 2019-11-26 17:25:45
有时项目中需要一个文件批量上传功能时,个人认为uploadify是快速简便的解决方案。 先上效果图: 一. 下载uploadify 从官网下载uploadify的Flash版本(Flash版本免费,另一版本HTML5版本需要付费) 下载地址: http://www.uploadify.com/download/ 下载后直接把文件解压,然后放在项目中 二. 在项目中使用 在页面中引入: <!--引入Jquery--> <script src="js/jquery-1.11.3.min.js"></script> <!--引入uploadify--> <script type="text/javascript" src="uploadify/jquery.uploadify.js"></script> <link type="text/css" href="uploadify/uploadify.css" rel="stylesheet" /> 完整页面代码 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head

How easily can you guess a GUID that might be generated?

安稳与你 提交于 2019-11-26 16:40:01
问题 GUIDs get used a lot in creating session keys for web applications. I've always wondered about the safety of this practice. Since the GUID is generated based on information from the machine, and the time, along with a few other factors, how hard is it to guess of likely GUIDs that will come up in the future. Let's say you started 1000, or 10000 new sessions, to get a good dataset of the GUIDs being generated. Would this make it any easier to generate a GUID that might be used for another

Identity change GUID to int

穿精又带淫゛_ 提交于 2019-11-26 16:17:30
问题 How does one change the PK column of the AspNetUser table from a guid to int data type? This should now be possible with the latest asp.net-identity version which got released today. But I can't find anywhere how this is done? 回答1: By default the ASP.NET Identity (using Entity Framework) uses strings as the primary keys, not GUIDs, but it does store GUIDs in those string. You need to define a few more classes, I've just created a new project (I'm using the VS2013 Update 2 CTP), here are the

How Random is System.Guid.NewGuid()? (Take two)

一曲冷凌霜 提交于 2019-11-26 16:16:03
Before you start marking this as a duplicate , read me out. The other question has a (most likely) incorrect accepted answer. I do not know how .NET generates its GUIDs, probably only Microsoft does, but there's a high chance it simply calls CoCreateGuid() . That function however is documented to be calling UuidCreate() . And the algorithms for creating an UUID are pretty well documented . Long story short, be as it may, it seems that System.Guid.NewGuid() indeed uses version 4 UUID generation algorithm , because all the GUIDs it generates matches the criteria (see for yourself, I tried a

Is it safe to assume a GUID will always be unique?

心不动则不痛 提交于 2019-11-26 15:50:49
I know there is a minute possibility of a clash but if I generated a batch of 1000 GUIDs (for example), would it be safe to assume they're all unique to save testing each one? Bonus question An optimal way to test a GUID for uniqueness? Bloom filter maybe? Antal Spector-Zabusky Yes, you can. Since GUIDs are 128 bits long, there is admittedly a minute possibility of a clash—but the word "minute" is nowhere near strong enough. There are so many GUIDs that if you generate several trillion of them randomly, you're still more likely to get hit by a meteorite than to have even one collision (from

How to Create Deterministic Guids

混江龙づ霸主 提交于 2019-11-26 15:45:48
In our application we are creating Xml files with an attribute that has a Guid value. This value needed to be consistent between file upgrades. So even if everything else in the file changes, the guid value for the attribute should remain the same. One obvious solution was to create a static dictionary with the filename and the Guids to be used for them. Then whenever we generate the file, we look up the dictionary for the filename and use the corresponding guid. But this is not feasible because we might scale to 100's of files and didnt want to maintain big list of guids. So another approach