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 2005 Forums
 Transact-SQL (2005)
 Inserting Data drawn from two tables.

Author  Topic 

dbnewb
Starting Member

1 Post

Posted - 2009-06-15 : 16:50:58
Hi,

This is probably something extremely easy, but I am having trouble forming the syntax to complete my problem

I have two tables, personnel and manualrole that have different amount of columns and column names. The only thing that is similar between the two tables is that they share the same key pn_id.

I need to be able to select the data in the first table personnel and insert new rows in manualrole where pn_id meets the correct criteria.

Because pn_id is shared across both tables it makes it hard to distinctly select the pn_ids that are only in the personnel table.

I have a cursor set up that fetches the rows, but I cannot seem to be able to get it to work with two tables. It only wants to fetch the data from the 2nd table.

could anyone offer any advice or direction as to what I can do to solve my problem?

Thanks you for any help.

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-06-15 : 16:59:10
read about outer join.
Go to Top of Page
   

- Advertisement -