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
 Transact-SQL (2000)
 statement won't work...why?

Author  Topic 

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2004-09-10 : 14:18:38
Can anyone see what is wrong with this?


join = "IF NOT EXISTS(SELECT * from tblCapRec) INSERT INTO tblCapRec (CaseNumber,PartNumber,Status,LastName,FirstName,SSN,OtherSSN,OtherNotes,InGDB,DocsOrdered,DocsHere,AppHere,Ubum,Suspended,SentToHUD,SentToTSI,SentToCredit,SpanishCase,MailAddress,MailCity,MailState,MailZipCode,CareOf,HomePhone,OtherPhone,PropAddress,PropCity,PropState,PropZipCode,Updated,MailKey,MailedFirst,MortgageAmt,PaidUpFront,EndorseDate,Term,MatureDate,EncumDate,HoldingMor,ServingMor,RcvdFromOld,RcvdFromRegular,RcvdFromRtn,RcvdFrom2s,RefundAmt SELECT t1.CaseNumber,1,1,t1.Lastname,t1.FirstName,t2.akas_ssn_1,t2.akas_ssn_2,t2.subj_first_1+t2.subj_middle_1+t2.subj_last_1+t2.subj_suffix_1,0,0,0,0,0,0,0,0,0,0,t2.subj_address_1,t2.subj_city_1,t2.subj_state_1,t2.subj_zipcode_1,t1.CareOf,t2.subj_phone10_1,subj_phone10_2,t2.subj_phone10_3,t1.PropAddress,t1.PropCity,t1.PropState,t1.PropZipCode,GETDATE(),1,GETDATE(),t1.MortAmount,t1.PaidUpFront,t1.EndorseMonth+'/'+t1.EndorseDay+'/'+t1.EndorseYear,t1.Term,t1.MaturityMonth+'/'+t1.MaturityDay+'/'+t1.MaturityYear,t1.EncumMonth+'/'+t1.EncumDay+'/'+t1.EncumYear,t1.HoldingMor,t1.ServingMor,0,0,0,0,t1.RefundAmount FROM tblAbove1500 as t1 INNER JOIN tblAccurint_Above1500 as t2 ON t1.CaseNumber = t2.acctno WHERE NOT EXISTS (SELECT * From tblCapRec WHERE t1.CaseNumber = tblCapRec.CaseNumber)"


I don't understand why it is not working. I know it is kind of long, but I would love it if you could look at it. Thanks!

Brenda

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-09-10 : 14:33:27
You are missing the close paren before the SELECT.

-PatP
Go to Top of Page

brendalisalowe
Constraint Violating Yak Guru

269 Posts

Posted - 2004-09-10 : 14:36:09
THanks! I must be dumb!

Brenda
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-09-10 : 15:49:48
Not hardly. I'm pretty sure that I cornered the "dumb" market a long time ago!

-PatP
Go to Top of Page
   

- Advertisement -