uniqueidentifier

AFTER INSERT Trigger for SQL Server to create unique random 8 character code?

I started with some stored procedure code by Raymond Lewallen for a password generator. I would like to create a trigger that will create a unique 8 character ID each time a new row (a customer) is inserted. What I have so far: CREATE procedure dbo.AllAccessIDgenerator (
   @showID varchar(40) @accessID varchar(100) O...

uniqueidentifier in Sql Server database - how to generate in Java environment?

I have a database table that uses Sql Server 2005's uniqueidentifier column. I know how to create GUIDs in C#... string newid = System.Guid.NewGuid().ToString(); However, the application that is inserting into this database is running Java. Is there a way to generate Sql-Server-compatible GUIDs using Java code? (NOTE: generating th...

Formulae's to generate a unique id?

I would like to get a few ideas on generating unique id's without using the GUID. Preferably i would like the unique value to be of type int32. I'm looking for something that can be used for database primary key as well as being url friendly. Can these considered Unique? 1) (int)DateTime.Now.Ticks 2) (int)DateTime.Now * RandomNumber ...

ProviderKey the only option for unique identifier in MembershipUser object?

I'm trying to integrate an existing schema into a custom provider but the MembershipUser object only seems to have ProviderKey, an object, based on a uniqueIdentifier. How can I store my existing set of ID's for my users in this object as well and pull them from the DB when I get user information? I need the legacy key to access all my...

Generating unique and opaque user IDs in Google App Engine

I'm working on an application that lets registered users create or upload content, and allows anonymous users to view that content and browse registered users' pages to find that content - this is very similar to how a site like Flickr, for example, allows people to browse its users' pages. To do this, I need a way to identify the user ...

Unique identifier for user profiles in Windows

For a client/server application I need to centrally store parts of the configuration information that usually goes into the users profile directory. The client application would on first use write a file or registry entry with a GUID into the current profile. This GUID would subsequently be used as a key in the configuration database on...

Best way to get PK Guid of inserted row

Hi all, I've read this question about getting the identity of an inserted row. My question is sort of related. Is there a way to get the guid for an inserted row? The table I am working with has a guid as the primary key (defaulted to newid), and I would like to retrieve that guid after inserting the row. Is there anything like @@IDE...

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

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 ...

Increment a uniqueidentifier in TSQL

I am looking for a way to increment a uniqueidentifier by 1 in TSQL. For example, if the id is A6BC60AD-A4D9-46F4-A7D3-98B2A7237A9E, I'd like to be able to select A6BC60AD-A4D9-46F4-A7D3-98B2A7237A9F. @rein It's for a data import. We have an intermediate table with IDs that we're generating records from, and we join on those IDs later...

Sql Server: uniqueidentifier plus integer compound PK ... what type of index to use?

I have a junction table in my SQL Server 2005 database that consist of two columns: object_id (uniqueidentifier) property_id (integer) These values together make a compound primary key. What's the best way to create this PK index for SELECT performance? If the columns were two integers, I would just use a compound clustered index (...

Using SqlServer uniqueidentifier/updated date columns with Linq to Sql - Best Approach

Rightly or wrongly, I am using unique identifier as a Primary Key for tables in my sqlserver database. I have generated a model using linq to sql (c#), however where in the case of an identity column linq to sql generates a unique key on inserting a new record for guid /uniqueidentifier the default value of 00000000-0000-0000-0000-000000...

sequence ID for handling reliability

I'm trying to figure out a simple way to handle reliability for UDP messages. I figured I would just send each one with a sequencing ID and by comparing the ID to the one previously received, a loss can be detected. I would normally just use integers however the idea that it would just keep incrementing indefinitely did not sit right wit...

Is it safe to use Socket.LocalEndPoint as a unique id?

Hello; When a server accepts a client over a tcp/ip connection, a new socket is created. Is it safe to use the LocalEndPoint port (from the client perspective) as an id? Example (from the server perspective): int clientId = ((IPEndPoint)client.RemoteEndPoint).Port; On my local machine, the port seems to be unique, but with multiple cl...

SQL Server: Search all tables for a particular GUID

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 v...

Generate C# Long Unique ID

Hey! I have an SQL database with a set of tables that have Unique Id's. For the longest time I have been using the unique Identifier datatype and passing in a guid from my C# interface. However for the purpose of speed when querying I have decided to switch to using a bigint and passing in a long. Whats the easiest way to create unique ...

How can I create unique identifiers in Perl?

I am creating a file-oriented database of some test results performed by various users. For this I need to generate unique id for every entry in the database. The ids must satisfy following requirements: Ids should be fairly small (6 characters at most) For every test case and user combination each time same id should be generated Wh...

How to generate unique URL variables that match to a db record?

Hello all, I wish to be able to generate URL variables like this: http://example.com/195yq http://example.com/195yp http://example.com/195yg http://example.com/195yf The variables will match to a MySQL record set so that I can pull it out. At the time of creation of that record set, I wish to create this key for it. How can I do th...

How would you skip vulgar words using base 36 against an Id column in sql server 08?

I need the shortest possible Ids so I figure base-36 would work wonderful for this. The thought is I'll just use an auto-incrementing Id field as the primary key and then create a base-36 userid. Unfortunately I'll inevitably run into a lot of vulgar word combinations. I'm having a hard time wrapping my head around the best approach to s...

A question regarding string instance uniqueness in python

I was trying to figure out which integers python only instantiates once (-6 to 256 it seems), and in the process stumbled on some string behaviour I can't see the pattern in. Sometimes, equal strings created in different ways share the same id, sometimes not. This code: A = "10000" B = "10000" C = "100" + "00" D = "%i"%10000 E = str(100...

How unique is UUID?

How safe is it to use UUID to uniquely identify something (I'm using it for files uploaded to the server)? As I understand it, it is based off random numbers. However, it seems to me that given enough time, it would eventually repeat it self, just by pure chance. Is there a better system or a pattern of some type to alleviate this issue?...