I am reading through some code and came across the following lines:
await connection.ExecuteAsync("CREATE TABLE #TempTable (Col1 NVARCHAR(20), Col2 NVARCHAR(20))", transaction: transaction);
await connection.BulkInsertAsync("INSERT INTO #TempTable VALUES (@Col1,@Col2) ...", transaction: transaction);
If I try pasting the above statements into SSMS, I get a message Incorrect syntax near '.'.
; however, it seems to work just fine here. I'd like to figure out what this is doing to know whether or not it's safe to remove.
1条答案
按热度按时间lf5gs5x21#
I figured it out.
BulkInsertAsync
actually comes from theFaithlife.Utility.Dapper
library, not directly from Dapper. According to their documentation, you must include an ellipsis after an insert statement's values.