1drop table if exists t1; 2## Creating new table t1 ## 3CREATE TABLE t1 4( 5id INT NOT NULL auto_increment, 6PRIMARY KEY (id), 7name VARCHAR(30) 8); 9'#--------------------FN_DYNVARS_051_01-------------------------#' 10## Setting value of variable to 100 ## 11SET @@session.insert_id = 100; 12SELECT @@session.insert_id; 13@@session.insert_id 14100 15## Inserting some rows in table ## 16INSERT into t1(name) values('Record_1'); 17INSERT into t1(name) values('Record_2'); 18## Verifying rows in table ## 19SELECT * from t1 order by name; 20id name 21100 Record_1 22101 Record_2 23SELECT @@session.insert_id; 24@@session.insert_id 250 26INSERT into t1(name) values('Record_3'); 27'#--------------------FN_DYNVARS_051_02-------------------------#' 28## Creating & Connecting new connection test_con1 ## 29## Setting value of insert_id to 50 ## 30SET @@session.insert_id = 50; 31SELECT @@session.insert_id; 32@@session.insert_id 3350 34## Inserting rows in table t1 ## 35INSERT into t1(name) values('Record_4'); 36INSERT into t1(name) values('Record_5'); 37INSERT into t1(name) values('Record_6'); 38SELECT * from t1 order by name; 39id name 40100 Record_1 41101 Record_2 42102 Record_3 4350 Record_4 44103 Record_5 45104 Record_6 46'Bug#35376 Value of insert_id automatically resets to 0 after inserting 47' 1st row' 48'#--------------------FN_DYNVARS_051_03-------------------------#' 49## Creating and switching to new connection test_con2 ## 50## Setting session value of variable to 25 ## 51SET @@session.insert_id = 25; 52## Inserting some rows in table ## 53INSERT into t1(name) values('Record_7'); 54INSERT into t1(name) values('Record_8'); 55## Verifying data in table t1 ## 56SELECT * from t1 order by name; 57id name 58100 Record_1 59101 Record_2 60102 Record_3 6150 Record_4 62103 Record_5 63104 Record_6 6425 Record_7 65105 Record_8 66## Dropping table t1 ## 67drop table t1; 68## Disconnecting connections ## 69