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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored procedure for inserting and generating foreign keys on multiple table from a single table.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-01 : 16:27:59
Biju writes "Hi
I have a table with around 20 fields with multiple records. First 10 fields has to put into one table and the second 10 fields in to another table.And there should be a foreign key relation among the destination table.
This needs to be implemented using a stored procedure.
For example :
Source table
EmpId   EmpName  EmpAdd1 EmpAdd2 PhoneNo 
1 MyName Add1 Add2 123456


Destination tables
Table1
Id EmpName EmpAdd1
100 MyName Add1

Table2
Id EmpAdd2 PhoneNo
100 Add2 124356


The Id in table1 and Table2 can be sequence numbers.

here structure of Table1 and Table2 is already defined."
   

- Advertisement -