Skip to content

Instantly share code, notes, and snippets.

@musukvl
Created November 2, 2017 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musukvl/f01c22a60e54859c72070a1c84abe2d3 to your computer and use it in GitHub Desktop.
Save musukvl/f01c22a60e54859c72070a1c84abe2d3 to your computer and use it in GitHub Desktop.
Insert 100 000 from C# code
using (var dbContext = new MainDbContext())
{
for (var i = 0; i < 100000; i++)
{
dbContext.Database.ExecuteSqlCommand(
@"INSERT INTO [dbo].[Log] ([Key], [Data], [UpdatedDate])
VALUES (
convert(nchar(36), NEWID()),
'Some random data:' + convert(nchar(36), NEWID()),
GETDATE())");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment