Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to create format file in bulk insert using VB?How to dynamically create a table?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-12 : 09:17:29
Puneeta writes "What is the significanace of a format file in Bulk insert?
How to create a format file for copy data in file to a Table?

I have to dynamically create a table based on the no. of columns in the data file.The no. of columns are not known. How can this be done using VB?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-12 : 09:20:38
The layout of the bcp format file is explained in detail in Books Online. It is a simple text file. You can write a VB program to read the data file and determine column names and such and use that to generate the bcp format file.

As far as dynamically creating the table, it's possible, but you are going to have to do a lot of work in determining the data types for the columns. If you are going to use varchar(255) or something for all of the columns, save yourself time and don't bother importing it into SQL Server, you'd get no advantage with a structure like that.

Go to Top of Page
   

- Advertisement -