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)
 Join and Insert into 1 table...help!

Author  Topic 

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2004-08-09 : 12:53:26
I need to retreive data from two different tables and insert it into one table. This is the coding I have so far:

INSERT INTO tblCapRec (CaseNumber,PartNumber,Status,LastName,FirstName,Others,SSN,OtherSSN,OtherNotes,InGDB,DocsOrdered,DocsHere,AppHere,Suspended,SentToHUD,SentToTSI,SentToCredit,SpanishCase,MailAddress,MailAddress2,MailCity,MailState,MailZipCode,CareOf,HomePhone,WorkPhone,CellPhone,FaxPhone,OtherPhone,SpousePhone,SpouseWork,SpouseCell,SpouseOther,PropAddress,PropCity,PropState,PropZipCode,Updated,MailKey,MailedFirst,FirstRcvd,AppSent,AppSent2,AppSent3,AppSent4,AppSent5,OrderedDocs,AppRcvd,Paid,FirstBillSent,SecondBillSent,FinalBillSent,FeePaid,MortgageAmt,PaidUpFront,EndorseDate,Term,MatureDate,EncumDate,HoldingMor,ServingMor,RcvdFromOld,RcvdFromRegular,RcvdFromRtn,RcvdFrom2s,RcvdText,RefundAmt,RateCharged,AmtPaid,LateFees,Contract,TFC,Application,Docs,Other,Notes)
SELECT * FROM tblBack_From_Accurint INNER JOIN tblHUDdata
ON tblBack_From_Accurint.acctno = tblHUDdata.CaseNumber

What do I put where I have the "*"? Any input would be great! Thanks!

Brenda

Nedra
Starting Member

21 Posts

Posted - 2004-08-09 : 12:56:16
You just need to list the columns from the two tables that correspond to the columns in your insert list. You will need to make sure the select column order is the same as insert column list order.
Go to Top of Page
   

- Advertisement -