uniqueidentifier

MySQL UUID() when not unique?

ⅰ亾dé卋堺 提交于 2019-12-04 16:56:05
What happens when a UUID() generated by MySQL is not unique? If this is for a column that is a primary key, does MySQL error out, or does it try generating another UUID until a truly unique one is found? Well, if you call UUID() twice and get the same results, the most problematic thing would be that "stuff is broken" (tm). It's supposed to be unique and it should be always, as far as I know. There would be no "regenerate" code available: the function is designed to create unique keys even across computers, so how could it even know its result was not unique? from http://dev.mysql.com/doc

How to generate random Base36 IDs

帅比萌擦擦* 提交于 2019-12-04 16:16:36
Is there a way of generating random base36 identifiers with a defined character count in SQL Server? I have searched and found many examples of converting base 36 to int and vice versa, but not for randomly generating unique IDs. This solution a bit verbose but works and can easily be adapted to a variety of requirements. Here's some sample output: aapx0k k4fdbb vzbl5x 8vr1bs gbix1q g5kctv he6e50 m9j0m0 2vz53l yw72hs hgbo5h 3oen9v 6t4q75 337670 5sf3h4 yqr35s xoh4hh tc0wtf w7trkj lnnpdk zk2ln1 1gt7qr l6m72n ja5kvm kg6f9y 6t3b7a ujfr0i 2jatgo 0yv8rv wvbjfa Note that you need to create a view to

Best way to get a unique identifier in C# [duplicate]

你离开我真会死。 提交于 2019-12-04 13:47:30
问题 This question already has answers here : Unique computer ID (3 answers) Closed 5 years ago . I've asked a similar question before, but I'm now reducing some of the restrictions about what I need. I need to find a unique identifier on a computer, efficiently, with C#. It should always stay the same on any particular computer, and can be a composite of many factors - provided it's simple to retrieve. I've thought about using the MAC address with WMI Network queries, but this is too slow as

Windows Unique Identifier?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 13:01:16
So there is this software. When installed it somehow (probably reads file or registry entry) recognizes my windows operating system. It's supposed to do some tasks only once per unique computer. If I uninstall the program and re install it, the software remembers that it has been installed and therefore do not do the task. If I use system restore, software also does not do the tasks. If I load image of the system before the install, software also doesn't do the tasks. If I re install a fresh copy of windows, then only the software does the task. IP even does not matter. Everything is the same,

Clustered/non-clustered index on unique identifier column in SQL Server

微笑、不失礼 提交于 2019-12-04 12:48:57
I have read the various questions/answers here that basically indicate that having a clustered index on a uniqueidentifier column is a poor choice for performance reasons. Regardless, I need to use a uniqueidentifier as my primary key, and I do NOT want to use newsequentialid() because the generated values are too similar to one another (I need more random IDs so users can't [reasonably] 'guess' another ID). So, what is the best way to index this PK? Even though a clustered index on this column is not ideal, is it better than a "unique, non-clustered" index? I'm using SQL Server 2005. First of

SQL Server database with clustered GUID PKs - switch clustered index or switch to sequential (comb) GUIDs?

泄露秘密 提交于 2019-12-04 08:34:50
We have a database in which all the PKs are GUIDs, and most of the PKs are also the clustered index for the table. We know that this is bad (due to the random nature of GUIDs). So, it seems there are basically two options here (short of throwing out GUIDs as PKs altogether, which we cannot do (at least not at this time)). We could change the GUID generation algorithm to e.g. the one that NHibernate uses, as detailed in this post , or we could, for the tables that are under the heaviest use, change to a different clustered index, e.g. an IDENTITY column, and keep the "random" GUIDs as PKs. Is

PL/pgSQL column name the same as variable

大兔子大兔子 提交于 2019-12-04 08:05:46
I'm new to plpgsql and I'm trying to create function that will check if a certain value exists in table and if not will add a row. CREATE OR REPLACE FUNCTION hire( id_pracownika integer, imie character varying, nazwisko character varying, miasto character varying, pensja real) RETURNS TEXT AS $BODY$ DECLARE wynik TEXT; sprawdzenie INT; BEGIN sprawdzenie = id_pracownika; IF EXISTS (SELECT id_pracownika FROM pracownicy WHERE id_pracownika=sprawdzenie) THEN wynik = "JUZ ISTNIEJE"; RETURN wynik; ELSE INSERT INTO pracownicy(id_pracownika,imie,nazwisko,miasto,pensja) VALUES (id_pracownika,imie

SQL Server: Search all tables for a particular GUID

≯℡__Kan透↙ 提交于 2019-12-04 06:26:10
问题 i came across the need to cleanse some data, and i need to find some particular guids (i.e. uniqueidentifiers ) in SQL Server°. i've come up with a stored procedure that does a SELECT from every uniqueidentifier column in every table in the current database, and returns a result set if the guid is found. It uses the INFORMATION_SCHEMA views to find all uniqueidentifier columns in all base tables (as opposed to views). For each column it issues a select, returning the name of the table and the

Creating a Globally Unique Android Identifier

纵饮孤独 提交于 2019-12-04 05:53:38
When talking about unique Android ID's, I'm sure everyone has seen this , however I too am trying to come up with a solution to uniquely identify any android device. I would be happy to use a publicly released class but I am yet to find one. In my situation, the requirement is to be able to uniquely identify any devices that have some form of an internet connection (such as GPRS or Wi-Fi) and run on API level 8 (v2.2 Froyo). I'm not aware of any devices that doesn't have Wi-Fi or a SIM so let me know if there is any! We solved this problem in iOS by using a hash of the Wi-Fi mac address as all

Why does aspnet_users use guid for id rather than incrementing int? bonus points for help on extending user fields

倖福魔咒の 提交于 2019-12-04 05:32:33
Why does aspnet_users use guid for id rather than incrementing int? Also is there any reason no to use this in other tables as the primary key? It feels a bit odd as I know most apps I've worked with in the past just use the normal int system. I'm also about to start using this id to match against an extended details table for extra user prefs etc. I was also considering using a link table with a guid and an int in it, but decided that as I don't think I actually need to have user id as a public int. Although I would like to have the int (feels easier to do a user lookup etc stackoverflow.com