I have a linq to sql table/class that uses a GUID as both a primary key and as foreign key.
This problem came up when factoring some code that previously worked.
The exception generated is
"Operation is not valid due to the current state of the object."
The process I use is as such:
aspnet_User user() = new aspnet_User();
aspnet_use...
So I have a table with an identity column as the primary key, so it is an integer. So, why does SCOPE_IDENTITY() always return a decimal value instead of an int to my C# application? This is really annoying since decimal values will not implicitly convert to integers in C#, which means I now have to rewrite a bunch of stuff and have a lo...
If I have a table of a hundred users normally I would just set up an auto-increment userID column as the primary key. But if suddenly we have a million users or 5 million users then that becomes really difficult because I would want to start becoming more distributed in which case an auto-increment primary key would be useless as each no...
In Django Design Patterns, the author recommends using zlib.crc32 to mask primary keys in URLs. After some quick testing, I noticed that crc32 produces negative integers about half the time, which seems undesirable for use in a URL. zlib.adler32 does not appear to produce negatives, but is described as "weaker" than CRC.
Is this method...
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastName)
)
The above example is taken from w3schools.
From the above example, my understanding is that both P_Id, LastName together represents a Primary Ke...
Hi
Is there any way to massively alter primary keys(uid) to all tables with no primary keys in sql server database ? I have a lot of tables and most of them don not have primary keys.
Thanks in advance.
...
I'm trying to learn how to use keys and to break the habit of necessarily having SERIAL type IDs for all rows in all my tables. At the same time, I'm also doing many-to-many relationships, and so requiring unique values on either column of the tables that coordinate the relationships would hamper that.
How can I define a primary key on...
My workplace doesn't use identity columns or GUIDs for primary keys. Instead, we retrieve "next IDs" from a table as needed, and increment the value for each insert.
Unfortunatly for me, LINQ-TO-SQL appears to be optimized around using identity columns. So I need to query and update the "NextId" table whenever I perform an insert. Fo...
Does it make sense to use UUID as primary key in MySQL?
What would be pros and cons of using UUID instead of regular INT, beside trouble of hand querying?
...
Hi all,
I'm currently building a project which involves a lot of collective intelligence. Every user visiting the web site gets created a unique profile and their data is later used to calculate best matches for themselves and other users.
By default, Django creates an INT(11) id field to handle models primary keys. I'm concerned with ...
Can I drop primary key index without dropping primary key constraint in postgresql?
...
Primary key attractiveness
I have a boss(and also users) that wants primary key to be sophisticated/smart/attractive control number(sort of like Social Security number, or credit card number format)
I just padded the primary key(in Views) with zeroes to appease their desire to make the control number sophisticated,smart and attractive....
How do I rename a primary key column in MySQL?
...
I have a table in MySQL that has a primary key:
mysql> desc gifts;
+---------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| giftID | int(11) | NO | PRI | NULL | |
| name | v...
A table is:
mysql> desc gifts;
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| giftID | int(11) | NO | PRI | NULL | auto_increment |
| name | v...
hi,
i have database structure where all the tables are having two columns for primary key.
for an example the table Author has two columns like AutherId which is a auto increment number and the pc_id which is unique to that pc the those are the composite keys
for the table. but when it comes to relations i have to define the both colum...
I am going to use a contrived example: one headquarter has one-or-many contacts. A contact can only belong to one headquarter.
TableName = Headquarter
Column 0 = Id : Guid [PK]
Column 1 = Name : nvarchar(100)
Column 2 = IsAnotherAttribute: bool
TableName = ContactInformation
Column 0 = Id : Guid ...
Good Morning,
I am working on project using JPA. I need to use a @OneToMany mapping on a class that has three primary keys. You can find the errors and the classes after this.
If anyone has an idea! Thanks in advance!
FF
javax.persistence.PersistenceException: No Persistence provider for EntityManager named JTA_pacePersistence: P...
how do i create a primary key for an account with a format like this:
ABC-123
ABC-124
ABC-125
another example:
BCA-111
BCA-112
BCA-113
and so on.
by the way im using mysql.is it possible to do auto increment when using this format?
...
I've got a table defined as :
OrderID bigint NOT NULL,
IDA varchar(50) NULL,
IDB bigint NULL,
[ ... 50 other non relevant columns ...]
The natural primary key for this table would be (OrderID,IDA,IDB), but this it not possible because IDA and IDB can be null (they can both be null, but they are never both defined at the same time). Ri...