Is there a way around this in SQL Server 2005?
(It bugs me, and every time I encounter it I get in to a strop. But this is the first time I've had to deal with AND been on Stack Overflow. Please, save what little sanity I posess!)
DimensionTable:
id INT IDENTITY(1,1)
FactTable:
source_id INT NOT NULL,
target_id INT NOT NULL
I...
People, I have a horrible legacy DB that i have to map in nHibernate, that im not allowed to change.
There is a horrible tree structure called FaultCodes with these fields:
ID int
eventID int
treeID int (unique per eventID)
parentTreeID int
ID is the PK, its used by other tables to join to this one.
Problem is, the parent/child r...
I have been unable to find any documentation on the .build method in Rails. (I am currently using 2.0.2)
Through experimentation it seems you can use the build method to add a record into a :has_many relationship before either record has been saved.
for example
Class Dog
:has_many :tags
:belongs_to :person
end
Class Person
:h...
I have a table like so:
Fiscal Year, Region, Country, Office1, Office2, Office3, Office4
Where office 1-4 are foreign keys.
I would like to get output like so:
Office 1: Fiscal Year, Region, Country
Office 2: Fiscal Year, Region, Country
Office 3: Fiscal Year, Region, Country
Office 4: Fiscal Year, Region, Country
Can this be done usi...
Hi,
I need to customize the column names for composite foreign keys in GORM, and I didn't find any document that shows how to do it. I know how to customize PK columns, and how to customize a single-column FK, but not multi-column FK. Is it possible at all?
Thanks.
...
Hi there,
Does anyone know if there is a quicker way of editing a record that has foreign keys in a table (in sql server).. i will explain.. i have approx 5 tables that have there own ID but are linked together using a foreign key...
Hence i needed to change the foreign key (the contract number in my case), but i had to copy each recor...
When using GridView's built in Sorting with Entity Framework, I can display foreign key values. For example...
<asp:boundfield HeaderText="Category" DataField="Category.Name" SortExpression="Category.Name" />
...but when the header is clicked to sort the items in the grid, how can I sort my List list by Category.Name?
I only have th...
I have a database table called Lesson:
columns: [LessonID, LessonNumber, Description] ...plus some other columns
I have another table called Lesson_ScoreBasedSelection:
columns: [LessonID,NextLessonID_1,NextLessonID_2,NextLessonID_3]
When a lesson is completed, its LessonID is looked up in the Lesson_ScoreBasedSelection table to get th...
Suppose I have these tables:
Fruits
- FruitID INT PK
- FruitName NVARCHAR(30)
- FruitStatusID INT FK: Statuses
Statuses
- StatusID INT PK
- StatusName NVARCHAR(30)
How do I update both the Fruit's name and its status in the database in these situations?:
Update a piece of Fruit that came from a previous L2E c...
I am using MySQL and I have a table with an index that is used as a foreign key in many other tables. I want to change the data type of the index (from signed to unsigned integer) , what is the best way to do this?
I tried altering the data type on the index field, but that fails because it is being used as a foreign key for other table...
Title says it all. I need a query for SqlServer 2000 to get a list of all foreign keys.
Additional info:
Whoops I guess the title doesn't say it all. I meant to add "that point to a particular column"
...
I have a three-tier Windows Forms DB application in VB.NET. I'm using VS 2005.
I'd like to display records in a table in a DataGridView. I can already display the records as is by binding the DataSource to the business class that talks to the DB class:
Dim assetList as List(Of Asset)
assetList = DB_Asset.GetAssetListOrderByID_Asset
...
I have a table whose primary key is used in several other tables and has several foreign keys to other tables.
CREATE TABLE location (
locationID INT NOT NULL AUTO_INCREMENT PRIMARY KEY
...
) ENGINE = InnoDB;
CREATE TABLE assignment (
assignmentID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
locationID INT NOT NULL,
FOREIGN...
How do I create a foreign key
from table tGeoAnswers column 'locationId'
to table tLocations column 'id'?
ALTER TABLE
tGeoAnswers
ADD
FK_Answer_Location
FOREIGN KEY
(locationId)
REFERENCES
tLocations(id)
I am trying this code that I found but I get the following error:
The definition for colu...
I am generating log records about user actions. For privacy reasons, these need to be anonymized after N days. However, I also need to run reports against this anonymized data.
I want all actions by real user A to be listed under fake user X in the anonymized logs - records of one user must still remain records of one (fake) user in the...
Is there an easy way to check if a foreign key exists for a column in a table? I am writing a script which will add the foreign key only if it does not exist.
Thanks
...
Given a model with ForeignKeyField (FKF) or ManyToManyField (MTMF) fields with a foreignkey to 'self' how can I prevent self (recursive) selection within the Django Admin (admin).
In short, it should be possible to prevent self (recursive) selection of a model instance in the admin. This applies when editing existing instances of a mod...
I have a column that is only 6 characters long in a table that references a column that is 20 characters using a foreign key constraint. How do I fix this?
Note: The issue was due to the limitation of the Oracle SQL Developer Edit table. When I performed the specific alter column, it worked fine.
...
hey,
i want to use 2 model in one foreignkey
it means;
i have 2 model named screencasts and articles. and i have a fave model, for favouriting this model entrys. can i use model dynamicly ?
class Articles(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
class Casts(models.Model):
title = ...
If I have two tables - Logins and Users, as follows:
Logins
LoginIdNo
UserIdNo
HashedPassword
Users
UserIdNo
LoginIdNo
Username
Each login "has a user" and each user "has a login" but which "belongs to" which?
Is it simply a judgment call or is there a clearcut formula for determining where the foreign key should reside?
...