Here's the story: I created a SQL Compact 3.5 database and used SQLMetal.exe to generate DataContext for it. It worked well, but soon I realized that it simply does not suit my needs so I decided to go for SQL Express 2008. I fired up the very same SQL script I used for the Compact to create schema and then fired up SQLMetal.exe tool. I ...
My company uses ElevateDB in one of our products. However, our database is just a bunch of tables. Recently, as more features are designed and more modules are added, we have found out our data is no longer “bunch of unrelated tables”, but it begins to be real data structure.
I have no previous experience with ElevateDB, I worked with O...
Hey there,
Ive got a WPF app, following the Model View ViewModel pattern, using the Entity Framework to interact with a SQL 2008 database.
Problem:
My problem is i can't change a foreign key value in the databse using EF. I have two entities: Site and Key. A Site can have many Keys on it. I would like to move a Key from one Site to a...
I have a requirement according to which I have to create a central Login system.We have 2 things Corporate and Brand each represented by tables "Corporate" and "Brand".
When a corporate gets registered,corporateID is given,When a user under that corporate gets registered there is a table corporateuser in which corporateID is a foreign k...
I have been coding with MySQL DBs for a couple years now and I have never used a foreign key. Now, I understand that a foreign key is like an ID on one table that corresponds with a primary key of another table. I have a user table on my site and probably around 10 other tables that all correspond with the primary key of my user table ...
I'm working with a bit of a dodgey database at the moment, there are foreign keys defined in all the wrong places all over the place, I'd like to remove them all and then start from scratch. I don't wish to remove the column, just the foreign key relationships.
How can I remove all foreign keys from an entire database? (Or table by tabl...
I'm having a bit of a strange problem, I'm trying to add a foreign key to one table that references another, but it is failing for some reason. With my limited knowledge of MySQL, the only thing that could possibly be suspect is that there is a foreign key on a different table referencing the one I am trying to reference.
Here is a pict...
Hi
Does anyone know a query for listing out all foreign keys in a database with "WITH NOCHECK" description applied to it? (removing them will boost performance and stability).
...
ALTER TABLE LAB_ADMIN_USER.TEST_TEMPLATE_ABBR ADD (
CONSTRAINT TEST_TEMPLATE_ABBR_R01
FOREIGN KEY (test_template_id)
REFERENCES LAB_ADMIN.TEST_TEMPLATE (test_template_id)
ON DELETE CASCADE)
What is the most likely cause of 'ORA=01031: insufficient privileges' when executing the command above? In other words, what permission do...
I am playing with making a blog. I would like to have several types of entries (a link to an interesting site + brief comment, a traditional blog post with title and body text, a picture... you get the idea).
The idea seemed straight forward. An entry table/model with a the few details common to all those types (creation time and a litt...
Hello,
I'm using .NET 3.5 SP1.
I created entity 'Category', based on table 'category_table' and 'MyUser', based on table 'App_User_table'.
CREATE TABLE category_table (
catg_id int,
catg_name varchar(50),
catg_description varchar(250)
)
CREATE TABLE App_User_table (
userid int,
username varchar(50),
fullname varchar(50), catg...
Hi,
I have a table with a single unique VARCHAR(512) field. I want to have another table hold a foreign key reference to this first table. Both tables use InnoDB.
If I add a VARCHAR(512) key to the second table and add a foreign key constraint on it will the 512 bytes long data be held twice?
If so, is there a way to hold only a refere...
SQLite comes with a utility, genfkey, that will generate triggers to enforce foreign key constraints. Here is the source. There is a README as well, just change previous url to f=sqlite/tool/genfkey.README (stackoverflow only letting me post one url)
Two pairs of triggers are generated per FK: BEFORE INSERT and BEFORE UPDATE on refere...
Basically, I have a table with a bunch of foreign keys and I'm trying to query only the first occurrence of a particular key by the "created" field. Using the Blog/Entry example, if the Entry model has a foreign key to Blog and a foreign key to User, then how can I construct a query to select all Entries in which a particular User has wr...
I did this:
ALTER TABLE `db`.`my_table`
ADD CONSTRAINT FOREIGN KEY (`my_second_table_id`)
REFERENCES `my_second_table` (`id`);
I should have done this:
ALTER TABLE `db`.`my_table`
ADD CONSTRAINT FOREIGN KEY (`my_second_table_id`)
REFERENCES `my_second_table` (`id`)
ON DELETE SET NULL;
Is it possible to ALTER this, or do I have...
In this document (scroll down to the Unidirectional section):
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping-association-collections
it says that a unidirectional one-to-many association with a join table is much preferred to just using a foreign key column in the owned entity. My question i...
We're having a problem where a mysqldump script is spending 90% of it's time populating a small handful of the tables it deals with. Eliminating FK's and indexes eliminates the speed problem, but is not an acceptable solution.
The dump script DOES have:
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET ...
I want to store which user invited another user to a group... but django is telling me this is ambigous and against the rules (which makes sense).
groups.group: Intermediary model
Group_to_Member has more than one
foreign key to User, which is
ambiguous and is not permitted.
So how do I do this correctly? Maybe a generic rel...
I mean things like:
FK1 -> 1FK2 -> 2PK
Please, note that 1FK2 is a PK to FK1, but the 1FK2 is a FK to 2PK. So the key in the nested structure is a FK and a PK.
An example:
--- Like an interface
CREATE TABLE q_content (
user_id SERIAL PRIMARY KEY, ---);
---- tables that refer to it
CREATE TABLE questions (
user_id SERIAL
refer...
Hi there,
Can anyone help?
I have a created a relationship between my Reservation(prim key) and Insurance(for key) tables and imported into linq2sql and checked my automatically created c# files and sure enough i have reservation.MyFieldNames etc etc PLUS reservation.Insurance which is my relationship but reservation.Insurance i can't ...