Guidance with bcp

Guidance with bcp

Post by Terry Balar » Sat, 14 Aug 1999 04:00:00



I am trying to load a data file in to a table using bcp.  The following
is the format file I'm using:
6.0
12
1       SQLNUMERIC    1       8       ""        1       Mstr_Nr
2       SQLCHAR       0       2       "="       2       Occup
3       SQLCHAR       0       30      "="       3       Name
4       SQLCHAR       0       30      "="       4       Addr1
5       SQLCHAR       0       30      "="       5       Addr2
6       SQLCHAR       0       16      "="       6       City
7       SQLCHAR       0       2       "="       7       State
8       SQLCHAR       0       5       "-"       8       ZipCode
9       SQLCHAR       0       4       "="       9       Zip_4
10      SQLCHAR       0       0       "="       0       County
11      SQLCHAR       0       4       "="       10      Car_Rt
12      SQLCHAR       0       3       "="       11      DPBC
13      SQLSHAR       0       0       "\r\n"    0       EndChar

County and EndChar do not exist in my table but they are in the data
file.  The MstrNr is an identity field in the table, but does not exist
in the data file. the "=" is the field separator in the data file.

Every time I enter the following DOS command  I get a major GP fault on
DOS and it is gone.

bcp lists_db.dbo.mstrtbl in sqltest.aa -fmstr.fmt -Sserver01 -T

Is there something obvious that I am doing wrong?

 
 
 

1. BCP Guidance Please

Hi folks,

Hope someone can help me out with this dilemma.

I have been tasked with the following:

Replicating an SQLServer 7.0 db to other servers, both on the LAN and wan.
Seems pretty straightforward, But...

First, the database I am replicating is not one we developed.  It is EZCAP
by Quadramed.  Previously, the used Centura as their engine.  Anyway, due to
support issues, etc., we cannot modify the database.  Stored procedures,
anything.  This includes any modifications done for replication.

The database I am putting the database into is for reporting only.  I will
be taking tables and views only.  Not a problem. I am running into a little
issue however.  I am using bcp out and in to replicate the tables. I am
having a problem with the "rowid" column, which is a timestamp datatype.
Initially, I changed the datatype to a varchar.  I used a -c switch in the
bcp command line.  That worked ok, except I can't figure out how to compare
the original field with new field.

I'm attempting to do all this without a format file.  All seems to work well
as long I use the -c switch.  I ran into the problem comparing the two
"rowid" columns, so I started experimenting with the -n and -N switches.
The data goes out ok, but I get lots of errors on the in portion.

sure would appreciate any help guidance as to how to deal with the timestamp
column.  I've looked through BOL, google, msdn and the kb.  Just can't get
it into my thick skull how to do it...

Here's the code I use for bcp in and out...

********bcpout********
EXEC master..xp_cmdshell 'bcp MONARCH..CLAIM_DETAILS out
C:\TEMP\CLAIM_DETAILS.txt -c /t"~|" /r
\r  -U -P -m8000 -eC:\TEMP\CLAIM_DETAILS_err.txt'

********bcpin*********
EXEC master..xp_cmdshell 'bcp TESTDB..CLAIM_DETAILS in
C:\TEMP\CLAIM_DETAILS.txt -c /t"~|" /r
\r  -U -P -m8000 -eC:\TEMP\CLAIM_DETAILS_err.txt  -b5000'

Thanks in advance,

Bud Dean

2. Using Views

3. Why should I change to Multi-tier thin client - guidance required

4. Is there no "DESCRIBE <TABLE>;" on PGSQL? help!!!

5. Request guidance for receiving data to SQL

6. FilemakerPro Clean Export to QuarkXpress

7. Guidance request = Tree

8. Cannot update the table Through View

9. Need expert guidance debugging a multi-threaded ODBC/S2K application

10. Need expert guidance on debugging a multi-threaded ODBC/S2K application

11. JSQL guidance.

12. guidance for standby server

13. Request guidance