> 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 |
|