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
 Getting Value in tables and insert to other tables

Author  Topic 

Limuh
Yak Posting Veteran

94 Posts

Posted - 2008-02-07 : 04:35:03
I want to compare two tables. if the data is existed to the other table i will insert it to other table if not exist it will load also to diffrent table.
Example: if my table was Tbl_StudentID and Tbl_FacultyID i want to insert in tbl_Grade if the data in Tbl_StudentID is exist or present in Tbl_FacultyID . And if the Tbl_StudentId is not exist in Tbl_FacultyID the data will move to Tbl_SupervisorID.

Please Help..

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-07 : 04:37:16
Are you using SQL Server 2005? If so, have a look at the new OUTPUT operator.
Example found here http://weblogs.sqlteam.com/peterl/archive/2007/10/03/New-OUTPUT-operator.aspx



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Limuh
Yak Posting Veteran

94 Posts

Posted - 2008-02-07 : 04:52:34
Im using SQL 2000. Thanks is there any ways to solve it?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-07 : 06:09:13
You want this check & insert to happen when you insert on Tbl_Student?If yes, then you can write a trigger for this.
Go to Top of Page
   

- Advertisement -