![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi. I'm pretty much a newby in sybase. what I'd like to do is to copy a table SDIPMS from db "A" to table SDIPMS to db "B". The tables have the same name but different data. In fact this copying would only be inserting into SDIPMS in db "B". Tables are defined as CREATE TABLE dbo.SDIPMS ( ID int NOT NULL, MO char(16) NOT NULL, CFAIL int NOT NULL, MSNES int NOT NULL, MSFES int NOT NULL, MSNSES int NOT NULL, MSFSES int NOT NULL, MSNUAS int NOT NULL, MSFUAS int NOT NULL, MSNUAV int NOT NULL, MSFUAV int NOT NULL, SMI int NOT NULL, MSNBBE int NULL, MSFBBE int NULL ) Tables also have indexes defined as: CREATE UNIQUE CLUSTERED INDEX I_SDIPMS ON SDIPMS (ID,MO) WITH IGNORE_DUP_KEY ON 'default' What I'm trying to do is to bulk copy SDIPMS table from A into a file on my unix machine and then bulk copy that file into SDIPMS table in B. I'm getting message: ------------------------------------------- Starting copy... Negative length-prefix found in BCP data-file. bcp copy in failed --------------------------------------------- |
|
Inserting data using queries is not an option as log is getting overloaded as my tables have like several millions of rows. |
#3
| |||
| |||
|
|
Could you post the entire bcp command (with command line args) that you're |
#4
| |||
| |||
|
|
/opt/sybase/sybase/OCS-12_5/bin/bcp csddbdb_temp..table_name in ./out_csddb/bcp_file_name -Usa -Psybase11 -SDEOMC1 -n |
|
That's all I use. I know I can do it step by step with queries but believe me, tables are HUGE. |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hello, This looks like a very old bug. Bug numbers 195198/193111. You may be able to workaround the issue depending on what version of bcp you are using (type "bcp -v" to get the version): http://www.sybase.com/detail?id=20439 You also might try bcping out in character mode (replace the -n with -c). If you can use character mode, be careful if any of your columns are text/image. If there are text/image columns you must specify column and row delimiters that you know will not exist in your data (for example -t"^~|" or -r "%^@"). - Neal Ok. |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Hello, That is the GA release of bcp which is about 3 years old. I remember a bug (but can't find the bug number right now) where bcp had problems when the last column in a table allowed NULLs. You could try working around this problem by altering your table defintion such that you move the last two columns that allow NULLs into the middle of the table definition: CREATE TABLE dbo.SDIPMS ( ID int NOT NULL, MO char(16) NOT NULL, CFAIL int NOT NULL, MSNBBE int NULL, MSFBBE int NULL CFAIL int NOT NULL, MSNES int NOT NULL, MSFES int NOT NULL, etc.. ) If that doesn't help I would recommend testing the latest EBF (12.5 ESD#14 or 12.5.1 ESD#3 from http://downloads.sybase.com). If after upgrading and/or altering the table definition doesn't help you may be running into something new or have bad data. You can use the first/last row flag to try and narrow it down to specific rows of data (-F and -L). Sybase technical support can help make that determination. Thanks, Neal Hi. |
![]() |
| Thread Tools | |
| Display Modes | |
| |