[dba-SQLServer] Bulk copy spec - was RE: [AccessD] using a saved SSIS with VB.Net

JWColby jwcolby at colbyconsulting.com
Tue May 1 06:06:03 CDT 2007


Is there any way to have SQL Server export a spec for a table that bulk copy
can use, at least what the fields look like etc?  I have never used bulk
copy and there are a LOT of fields in the table.  Alternately is there
somewhere that I can find the bulk copy spec, what the format file is
supposed to look like?


John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Eric Barro
Sent: Monday, April 30, 2007 7:31 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] using a saved SSIS with VB.Net

Have you looked into BULK INSERT in SQL? This is supposed to be a faster
data import method.


Using T-SQL you can do something like this...

CREATE TABLE #tmpEmployees (<fieldnames here>) BULK INSERT #tmpEmployees
FROM 'c:\temp\import.csv'
WITH (FORMATFILE = 'c:\temp\importCSV.fmt'

importCSV.fmt would contain the file format...in this example it's fixed
width

8.0
18
1   SQLCHAR   0   5   ""     1	suffix	SQL_Latin1_General_CP1_CI_AS
2   SQLCHAR   0   30   ""   2	last_name	SQL_Latin1_General_CP1_CI_AS
3   SQLCHAR   0   20   ""   3	first_name	SQL_Latin1_General_CP1_CI_AS





More information about the dba-SQLServer mailing list