Create an id autoincrement with dapper

Viewed 24

I'm working with Dapper and .Net 6.0... I have to do an insert from table1 to table2... in the insert the columns match each other... the only column is "toID" of table1... which does NOT match the column of table2 (that's why I put a 4 in it) but I have to make it auto-increment so that for each insert there is an incrementing sequence

var sql =
            $"INSERT INTO table1 (toId,teId,dateShift,SectorOrigen) SELECT  4,teID,@dateModify,@LastSector FROM table2";

That is to say... that when I generate an insert the ID = 1, then another ID = 2 and so on continuously

Any advice??

0 Answers
Related