Please look at this...

Results 1 to 3 of 3

Thread: Please look at this...

  1. #1
    Join Date
    Dec 1969

    Default Please look at this...

    If I have the following:<BR><BR>sql_statement_1 (Insert Statment)<BR><BR>&#039;Open Conn<BR>&#039;Begin Trans<BR>&#039;Conn.execute sql_statement_1<BR>&#039;Set rs2 = Conn.Execute("SELECT @@IDENTITY")<BR>&#039;newid=rs2(0)<BR><BR>&#039;In sert Into Table2 with sql_statement_2 containing newid<BR>&#039;Insert Into Table3 with sql_statement_3 containing newid<BR>&#039;Commit Trans<BR>&#039;Close Conn<BR><BR><BR>If let say sql_statement_3 has error while processing, will sql_statment_1 be rolled back? Since it is already inserted into the table

  2. #2
    Join Date
    Dec 1969

    Default no <eop>


  3. #3
    Join Date
    Dec 1969

    Default If you write those three sqls

    in a stored procedure inside the DB between a Begin Trans and End Trans Statement, then either they all will be committed or rolled back.<BR><BR>You can achieve the same in an ASP page using IF-THEN-ELSE statements and checking for errors.<BR><BR>INSERT SQL ONE<BR>Check for error if no errors Then<BR>INSERT SQL TWO<BR>check for error, if no error Then<BR>INSERT SQL THREE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts