Script to generate insert statements I am trying to write an SQL script to create an insert statement for each row of table TEST which has field A (int) and field B varchar(30), in my MS SQL database. 

I would like to save those insert statements into a txt file to be able to apply that data back to another database.

Any idea about how to do it?
Right-click on your Database in Object Explorer
Select Tasks -> Generate Scripts...
In that wizard you will be able to select the desired object(s) that you'd like to script out 
The next portion has an Advanced button, click that
Under General, you will see the option called Types of data to script.  The options are Schema only, Schema and data, or Data only.  I believe you want the last option (Data Only)