Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Which Isolation Level of transaction suit for this Operation (Sql Sever 2005)

$
0
0

 sql &= "INSERT into Gss_AC_JVHeader (Acc_No , Acc_SubNo , PlantID) Values (@Acc_No , @Acc_SubNo , 1) "
  sql2 = "INSERT into Gss_AC_Jv (JvHeader_ID , AC_Code_No , Debit , Credit ) Select Max(JvHeader_ID) ,  @AC_Code_No ,   @Debit , @Credit from  Gss_AC_JVHeader"

I have 2 insert query,  First query insert data into  Gss_AC_JVHeader table After that 

Second query get the max ID from first table then insert into another.

I worry about after first table had been insert but something insert into first table before second table get the right ID so

My data of second table would be inserted the wrong max ID . I think transaction concept may help me to prevent this but i

am not sure that which  Isolation Level of transaction suit for this?

Thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>