About 166,000 results
Open links in new tab
  1. How do I create a foreign key in SQL Server? - Stack Overflow

    I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far: drop table …

  2. Como adicionar uma foreign key em uma tabela já criada

    Jan 30, 2016 · Resolvido - A primary key da tabela 'pessoa' estava como 'unsigned' então houve uma incompatibilidade de tipo de dados. Porém pude sanar muitas dúvidas a respeito de …

  3. mysql - Add Foreign Key to existing table - Stack Overflow

    I had to run "SET FOREIGN_KEY_CHECKS=0;" before running the ADD CONSTRAINT command or SQL would complain "Cannot add or update a child row: a foreign key constraint …

  4. How to create a foreign key in phpmyadmin - Stack Overflow

    Jun 3, 2016 · To generate a foreign key you need to create first index of that field.After you create an index.Then go to relation view you will see that field also along with primary key .

  5. Add new column with foreign key constraint in one command

    Jul 15, 2013 · I am trying to add a new column that will be a foreign key. I have been able to add the column and the foreign key constraint using two separate ALTER TABLE commands: …

  6. mysql - Error Code: 1822. Failed to add the foreign key constaint ...

    Oct 13, 2014 · The only data type difference that is permitted between columns in a foreign key relationship is length of a varchar. For example, VARCHAR (10) can reference VARCHAR …

  7. mysql - ERROR 1452: Cannot add or update a child row: a foreign …

    Feb 9, 2014 · Taken from Using FOREIGN KEY Constraints Foreign key relationships involve a parent table that holds the central data values, and a child table with identical values pointing …

  8. Adding a foreign key to existing table - Stack Overflow

    ALTER statement for a multiple FOREIGN KEYS does not work. Each CONSTRAINT should be added individually : CREATE TABLE Gust ( Gust_ID INT PRIMARY KEY, First_Name …

  9. SQL Add foreign key to existing column - Stack Overflow

    If I am using the following SQL command in SQL Server 2008 to update a table with a foreign key constraint: ALTER TABLE Employees ADD FOREIGN KEY (UserID) REFERENCES …

  10. How to add 'ON DELETE CASCADE' in ALTER TABLE statement

    I have a foreign key constraint in my table, I want to add ON DELETE CASCADE to it. I have tried this: alter table child_table_name modify constraint fk_name foreign key (child_column_name)