Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 exporting data

Author  Topic 

hai
Yak Posting Veteran

84 Posts

Posted - 2007-06-01 : 15:15:57
I need to export the database to a file. because the database is to large the manager want it to break down to small file. I was looking at rowcount but got very lost at it. Let say if I have a 1,000,000 record. I want to break it down to 5 file 200,000 rcord each. How would I go around and do it.

thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-06-01 : 15:37:58
do you have a column that would make sense to break things up by, you could use bcp queryout:

bcp "select * from mytable where intcol between 1 and 1000" queryout myfile_1_1000.txt -c -T -SMYSERVER
bcp "select * from mytable where intcol between 1001 and 2000" queryout myfile_1001_2000.txt -c -T -SMYSERVER

and so on...


www.elsasoft.org
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-02 : 02:25:39
If not, create an identity column and use that column in the above

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -