Monday, February 13, 2012

Creating lots of test data on the DB with the help of excel

It was required for some scenario to create some data, and checking the data that needs to be added, I found that it is all in one table with some id that needs to be different for every record. so the first thing and simplest thing I thought off is to use excel to generate lots of insert statements

First I opened the DB client, and generated one insert statement with valid data

Second I opened excel, pasted the excel statement, divided it into cells, and kept the ID in a separate cell

Screenshot-2012-02-13_12.00.57

I made the ID to be incrementing in each row, then copied the rest of the cells to whatever number I needed of records

Screenshot-2012-02-13_12.02.30

Last, I took all these rows, pasted it in my DB editor, then executed, all records are created and now I have lots of test data to be used in my testing

No comments:

Post a Comment