Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Q on sql

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-10-10 : 07:31:52
Raghu writes "i have two table like emp, dept
emp
id. .ename....esal....etc... are columns of emp table
id is the primary key

dept:
deptid,dname, id .....etc ...are the columns of the dept
id is the foreign key


when ever insert values in to emp table the value of id also come in dept ?
i requesting to help?


iam doing project in c# with sqlserver"

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-10 : 07:36:26
No, it does not. You have to make two INSERT statements.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-10 : 07:55:26
Foreign key only ensures that the value you enter exist in reference table but it does not automatically add value. You will have to explicitly do that.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -