So you have a database table and you want to make a format file, but who wants to go through and make one by hand? You can get a head start by using the BCP (Bulk Copy Program) utility to create one for you.
You can use any existing table to do this. Open up a command window (DOS) and use the following syntax:
BCP database.dbo.tablename format nul -f FORMATNAME.FMT -c -SServerName -UUserName -PPassword
Substituting database, tablename, FORMATNAME.FMT, ServerName, UserName, and Password with your information.
This will generate a format file for use with a tab delimited file. You can then alter the delimiters if necessary from tab to something else.
Filed under: SQL Server | Tagged: bcp, format, sqlserver