English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2007-03-12 18:56:36 · 2 answers · asked by santanu guha 1 in Computers & Internet Software

2 answers

If you mean a foreign key, try this

ALTER TABLE tab1 ADD CONSTRAINT fk_name

FOREIGN KEY (tab1_column) REFERENCES tab2 tab2_column);

This will link tab1 and tab2 on the columns specified. Tab1.column will have to contain a value from tab2.column or null.

2007-03-13 03:52:44 · answer #1 · answered by Elizabeth Howard 6 · 0 0

its bit simple


I understand your question to be: "How do I create a relationship between two tables?" This depends on the DBMS, but I'll assume you mean SQL Server, since Blue Ink works primarily with that. I would highly recommend designing your database with a modeling tool such as Microsoft Visio (there is an article about this under the Articles section). Otherwise you can use the following technique to create the relationship by hand:

1. Click "Diagrams" under your database in the Enterprise Manager.

2. Right click and select "New Database Diagram."

3. Select the tables you want to join from the wizard and click Finish.

4. Drag your foreign key to your primary key and make sure to check: "Check existing data on creation" and "Enforce relationships for replication" and "Enforce relationships for INSERTs and UPDATEs"

5. Save

You can delete the diagram once your done or not (as long as you save it first), but I find this technique the next best thing to using a true modeling tool.

By the way sorry for the delay, I was out of town. I will respond more quickly in the future, and encourage others responding as well.

Once you have the relationship set up Blue Ink should be able to read the relationship and create an application with the correct links. Please let me know if this does not answer your question.

2007-03-13 02:01:47 · answer #2 · answered by sweetraskels 4 · 0 0

fedest.com, questions and answers