Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

How to create Format File using BCP command

Total Hit ( 22640)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


When you bulk import into a SQL Server table or bulk export data from a table, you can use a format file to store format information for each field in a data file relative to that table. A format file provides a flexible system for writing data files that requires little or no editing to comply with other data formats or to read data files from other software programs.

To create format file using bcp command Type the following line on comand Prompt

Click here to copy the following block
bcp Northwind.dbo.Products format nul -c -f "c:\Products.fmt" -T

It will create file something like this if you have SQL 2005 installed.

9.0
10
1       SQLINT        0       4       ""   1     ProductID                          ""
2       SQLCHAR       2       40      ""   2     ProductName                        SQL_Latin1_General_CP1_CI_AS
3       SQLINT        1       4       ""   3     SupplierID                         ""
4       SQLINT        1       4       ""   4     CategoryID                         ""
5       SQLCHAR       2       20      ""   5     QuantityPerUnit                    SQL_Latin1_General_CP1_CI_AS
6       SQLMONEY      1       8       ""   6     UnitPrice                          ""
7       SQLSMALLINT   1       2       ""   7     UnitsInStock                       ""
8       SQLSMALLINT   1       2       ""   8     UnitsOnOrder                       ""
9       SQLSMALLINT   1       2       ""   9     ReorderLevel                       ""
10      SQLBIT        1       1       ""   10    Discontinued 

fore more info visit the following url

http://msdn2.microsoft.com/en-us/library/ms191516.aspx


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.