Is there a way to export specific columns and a fixed number of rows from a table to INSERT statements?
I am trying to generate these for unit testing based on a large production table so using something like "Generate Scripts" in SQL Server Management Studio is out of the question.
There are a few tools that might be able to do this, but something so trivial in MySQL should not be that complex in SQL Server (at least I would hope not).
Best Answer
Use Import/Export wizard and instead of exporting the entire table, choose sql to export specific rows and columns.
You can write sql like :
select column1, column2 from Table1 where some_condition
or if you don't care about specific data then you can use top command to extract any number of rows that you require.Edit : Below are screenshots for Import export Wizard (Launch it from SSMS):
EDIT:
@Robin IN your situation, you can do 2 things -