Hi Guys,
According to Microsoft document about transaction, there is a feature called atomicity.
https://technet.microsoft.com/en-us/library/ms190612(v=sql.105).aspx
Basically it means within a transaction, either all of its data modifications are performed, or none of them is performed.
Now I have the following T-SQL code
SET IMPLICIT_TRANSACTIONS OFF CREATE TABLE class (c_id int primary key, c_name varchar(10)) INSERT INTO class VALUES (11, 'yuwen'),(12,'shuxue'),(13,'lishi') CREATE TABLE student (s_id int primary key, s_name varchar(10), c_id int foreign key references class (c_id)) BEGIN TRANSACTION INSERT INTO student VALUES (1,'bill',11) INSERT INTO student VALUES (2,'bill',14) COMMIT SELECT * FROM studentCan anyone explain why when we are looking at the student table, we can see that the first INSERT statement performed successfully, while the second didn't. I read from book saying that "foreign key violations do not cause all the statements to roll back", however, this conflict against the very basic transaction requirement regarding atomicity. How should I think about this?