dbTalk Databases Forums  

Re: Using bcp to import position based file

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Re: Using bcp to import position based file in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Using bcp to import position based file - 07-06-2003 , 05:14 PM






Michael (michael_baker (AT) advantexmail (DOT) net) writes:
Quote:
I am trying to find out if anyone has successfully used
bcp to import a positioned based file into sql server.
Is bcp capable of this type of import or is it only
capable of importing delminited flat files. If you have
any examples you could post that would be great. Thanks
in advance.
Yes, BCP can do this. A typical entry in a file would look like this:

1 SQLCHAR 0 20 "" 1 colname Latin1_General1_CS_AS

If you want specific help, please post the CREATE TABLE statement for
your table, and a sample of your data file.

--
Erland Sommarskog, SQL Server MVP, sommar (AT) algonet (DOT) se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Using bcp to import position based file - 07-07-2003 , 06:31 PM






Michael (michael_baker (AT) advantexmail (DOT) net) writes:
Quote:
Here is a sample table I am using to import information
for contact info:
CREATE TABLE [dbo].[ContactInfo] (
[FirstName] [nvarchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[LastName] [nvarchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[Street] [nvarchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[City] [nvarchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[State] [char] (2) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[ZipCode] [nvarchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

Here is a sample data file:
IHDRMichael
Baker 1234 My
street City
MO76543
I get the impression that the lines have been wrapped. That makes it
kind of difficult to produce a correct format file for it.

Can you try to put all the sample stuff into a zip file an attach it?


--
Erland Sommarskog, SQL Server MVP, sommar (AT) algonet (DOT) se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.