I am using Sybase 12.5.3, have a table with 12 million rows without any identity/id column. I want to parallely bcp out the data from table to 12 different files.
- Found that this can only be done if I make views on the table and then run bcp parallely (Reference: link-February 2012 question)
- My table has partitions also and I have partition ids only (Not partition names)
- Is there any way I cam make 12 different views of 1 million rows each using either the partitions or using some counterpart of rownum of Oracle in sybase
Help will be really appreciated !!
Best How To :
To bcp
out of the partitions, you can reference the partition name or partition number.
bcp mydb..bigtable:1 out file1 -Pmypassword -c &
bcp mydb..bigtable:2 out file2 -Pmypassword -c &
This would create a character (plaintext) output from partitions 1 & 2 of bigtable
Though much of the documentation concentrates on importing data, the systax for exporting is typically very close.
Alternatively, you can create views based on the values in the tables. Assuming there is a column that holds some sort of range (or catagorical) value that can be used to divide the data, you can use something like this:
create view mytable_VIEW_1 as
select * from bigtable
where myColumn < someValue1
create view mytable_VIEW_2 as
select * from bigtable
where myColumn between someValue2 and someValue3
Once your views are created, you can easily bcp
out from them.