Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 To: J.J. Castorena
  
 
 
 J.J. Castorena
 Tags
Subject: RE: Bulk copy
Thread ID: 22916 Message ID: 22960 # Views: 20 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Wednesday, April 30, 2003 6:03:08 PM         
   


> Hi Guys,
> I have a development (SqlServer 7.0) question, and have spent 6 hours attempting to resolve what should be a very simple issue.
>
> Specifically, I have a comma-delimited file and need to "bcp" (bulk copy) it into a sqlserver table. bcp prefers tab delimited, and all attempts at resolving the issue have failed, including some heavy research. The format file manipulations I've tried all failed with string truncation or file open errors. bcp is the fastest method for moving data around, so it will be my choice for this process. I dynamically provide (1) source data file name and (2) target database table name. I am using a format file, but cannot locate the proper syntax to identify row delimiters.
>
> MS will want a snippet of the file I'm trying to bcp-in, and a copy of the table structure. This info, below, is preparatory to the phone call, if needed.
>
> --T-SQL to create table
>
> if exists (select * from sysobjects where id = object_id(N'[dbo].[bch_CASS_BCPIN]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
> drop table [dbo].[bch_CASS_BCPIN]
> GO
>
> CREATE TABLE [dbo].[bch_CASS_BCPIN] (
> [Address] [varchar] (50) NULL ,
> [City] [varchar] (35) NULL ,
> [State] [char] (4) NULL ,
> [ZIP10] [char] (10) NULL ,
> [RecordID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
> [ZIP4] [char] (4) NULL ,
> [DPBC] [char] (2) NULL ,
> [CART] [char] (4) NULL ,
> [ZIP] [char] (10) NULL ,
> [CHK_DIGIT] [char] (1) NULL ,
> [LOT] [char] (5) NULL ,
> [LOT_ORDER] [char] (1) NULL ,
> [ERR_STAT] [char] (6) NULL ,
> [ENTRY_ID] [char] (1) NULL ,
> [MAIL_TYPE] [char] (4) NULL ,
> [MSS_SEQ] [char] (10) NULL ,
> [MSS_ENDOR] [char] (27) NULL ,
> [PKBRAKE] [char] (10) NULL ,
> [CARTON] [char] (10) NULL ,
> [PACKAGE] [char] (10) NULL ,
> [POST] [char] (15) NULL
> ) ON [PRIMARY]
> GO
>
>
Why don't you use DTS?
The forum I use for SQL is . It's pretty good and may be able to help you faster.

KTB

COMPLETE THREAD

Bulk copy Posted by J.J. Castorena @ 4/30/2003 12:24:00 AM
RE: Bulk copy Posted by Ken Blum @ 4/30/2003 6:03:08 PM