Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Second insert fails?

Status
Not open for further replies.

dakone

Programmer
Jun 23, 2003
28
CA
Code:
 END
        ELSE
            BEGIN

            --Add a new row if customer number doesn't already exist insert new values in the dynamics table RM00101
            INSERT INTO RM00101 (CUSTNMBR, CUSTNAME, ADRSCODE, ADDRESS1, CITY, STATE, COUNTRY, ZIP, PHONE1, FAX, FRSTINDT, CNTCPRSN, PHONE2)
           VALUES (@CUSTNMBR, @CUSTNAME, @ADRSCODE, @ADDRESS1, @CITY, @STATE, @COUNTRY, @ZIP, @PHONE1, @FAX, @FRSTINDT, @CNTCPRSN, 
                            @PHONE2) 

            --Add a new row if customer number doesn't already exist insert new values in the dynamics table RM00102
            INSERT INTO RM00102 (CUSTNMBR, ADRSCODE, ADDRESS1, CITY, STATE, COUNTRY, ZIP, PHONE1, FAX, PHONE2)
            VALUES (@CUSTNMBR, @ADRSCODE, @ADDRESS1, @CITY, @STATE, @COUNTRY, @ZIP, @PHONE1, @FAX, @PHONE2) 

          

            END
 
Nothing wrong with the sql statement syntax that I can see. Could be something as simple as a miss-spelt field name or different data type in the table - happened to me.

Maybe add PRINT @@error after each insert and run it in query analyzer to see if theres an error ?


Hope this helps

 
When you say the second insert fails, what error are you getting.. or is it just rolling back the changes?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top