Hi folks
i'm trying to create a Users table that only has OpenId registrations, exactly like StackOverflow.
I'm storing in the table
OpenId Identifier (their login name)
Alias (which is the display name to show to the public)
Some other openId stuff
So .. I want make sure that there is only ONE user in the system that has the open ...
Hi folks,
I've got a column in a table (eg. UserName) which I want to make sure is unique. So I create a unique key for that column and call it IX_Users_UserName.
Now, if I do lots of searching for users based on their username I want to make sure there is an index for that field.
Do I need to create a separate index, or is the unique...
I'm trying to create a relation where any of four different parts may be included, but any collection of the same parts should be handled as unique.
Example:
An assignment must have an assigned company, may optionally have an assigned location, workgroup and program.
An assignment may not have a workgroup without a location.
Let's assu...
I would like a solution to enforce a constraint only if a column is not null. I can't seem to find a way to do this in the documentation.
create table mytable(
table_identifier_a INTEGER,
table_identifier_b INTEGER,
table_value1,...)
Do to the nature of the data, I will have identifier b and a value when the table is created. Af...
Hi,
I'm having a table (an existing table with data in it) and that table has a column UserName.
I want this UserName to be unique.
So I add a constraint like this:
ALTER TABLE Users
ADD CONSTRAINT [IX_UniqueUserUserName] UNIQUE NONCLUSTERED ([UserName])
Now I keep getting the Error that duplicate users exist in this table.
But I ha...
What is the impact of changing a Unique key in SQL Server 2005
I am having a table one primary key ID int and composite unique key for 4 fields.
But due to nature of my project one of the keys(fields) of the composite key keeps on changing.
Does anyone find any problem in changing the field of composite key that often?
...
I have a few classes which have a property which is unique to that object, for example for the User class the property Username should never be duplicated.
NHibernate doesn't seem to support loading of an object by unique key which is then cached in the same way that Load() or Get() does. Am I correct when I say that?
If I am then I wi...
I want to generate unique hexadecimal numbers in SQL. How can I do this?
If you know how to generate in c# please also include that.
...
I have a sql server table with 2 fields, ID (primary key) and Name (unique key).
I'm using linq to sql to produce model objects for asp.net MVC from this table.
To perform the model validation I've implemented IDateErrorInfo in a partial class
public partial class Company : IDataErrorInfo
{
private Dictionary<string, string> _error...
I'm getting an array of strings from a JSON object. I want to save these strings in a DB, but only if they're not already in there. What's the best way to compare what's already in the DB with what I'm about to enter, and exclude matches?
I'm using PHP and MySQL. Thanks!
...
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...
This is a programming technique problem in the context of Java.
Problem: We have String keys that all need to be unique. The implementation of the collection is a combination of Map and ArrayList which allows one to use the collection as either a Map or ArrayList (JFreeChart's DefaultPieDataset if you are curious). If we have a single p...
I'm considering using this: http://phpgoogle.blogspot.com/2007/08/four-ways-to-generate-unique-id-by-php.html
My idea is to use a mixture between 2 and 3. But my question is that, although the chances are small, is there still a chance that two orders with the same order # can be generated if I substring the result to be only 5 characte...
I'd like to use Example.Create() to query just by the unique values of an instance. To do so I need to find out the value of the unique-key property that had been set inside the mapping file, like this:
<property name="MyColumn">
<column name="MyColumn" unique-key="MyUniqueKeyGroup"/>
</property>
For better understanding - her...
Hi,
I have a database with a Unique key on the the columns ParentRef and SortIndex.
In LINQ, I want to switch two SortIndex values. I want to do this in one transaction so there can be multiple users at once. How do I, with LINQ, switch the values in one go, so my Unique key does not be violated?
var dc = new MyDataContext();
...
How can i generate a unique key of length at most 12 character with these attributes:
Name, Father's name, Mother's name, Date of birth, Place of birth.
Thanks in advance :)
...
I was told by a friend:
What unique key do you use? I hope you
are not saving the entire user name
--- this will use up too much table space! Assign an unique userID to each
(unique) userNAME and save this userID
(should be INTEGER UNSIGNED
auto_increment or BIGINT UNSIGNED
auto_increment). Don't forget to
create a re...
Is it possible to have a varchar column as a primary key with values like 'a ' and 'a', is gives always this error "Violation of PRIMARY KEY constraint" in MS SQL Server 2008.
In Oracle dons't give any error.
BTW I'm not implementing this way I'm only trying to migrate the data from oracle to sql server.
Regards
...
I have a table with just a single field named "tag", which is a varchar(250)
the field is defined with collation 'latin1_spanish_ci', because I'm planning to save words in spanish...
the problem is that the following query
select * from test where tag = 'unó'
gives me exactly the same result as
select * from test where tag = 'uno'
...
Hi,
I have a model with a CharField that earlier had "unique" set to True, but wich now is changed to False. But when i try to save that field with something that exists django still throws an IntegrityError.
How can i change this behavior so that it allows non distinct values?
The database is MySQL.
...