I'm trying to achieve this using C#, to insert data from a csv file into Microsoft SQL Server.
I have a CSV file that does NOT have an identity column. I would like to insert data from this CSV into a table on Microsoft SQL Server that has an identity column, however, the identity column was not set to auto_increment.
Is there a way to achieve this? I looked into BULK INSERT
in SQL but I couldn't figure out how to get the identity column to work properly.
I was thinking to connect to the database and table to find out what the current largest id number is, then modify the CSV to include the identity column, the BULK INSERT
the new CSV. I think the idea might work, but I was just wondering if there is some other ways (more convenient way) to solve the problem.