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.
| Author |
Topic |
|
Jsolomon
Starting Member
13 Posts |
Posted - 2011-01-20 : 07:39:16
|
| I have a table with 35 million records. We need to export this to a csv file for use by outside vendor. They can only handle files of 2 million records or less. How can I export into files with 2 million each.Thanks for any advise.Jeff Solomon |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-01-20 : 07:43:16
|
| What sort of PK do you have on the table and is it static?I would insert the PKs into a table with an identity (clustered index on the identity). Then use that table for the export.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Jsolomon
Starting Member
13 Posts |
Posted - 2011-01-20 : 07:47:11
|
| The table does not have a PK. So I could give it a id or column number and export using a where id column > number AND id column < number? |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-01-20 : 07:51:49
|
| Yep.Or you could pick any column with reasonable selectivity andselect * from tbl where col in(select col from (select col, seq = rank() over (order by col)from tbl) awhere seq between ... and ....)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Jsolomon
Starting Member
13 Posts |
Posted - 2011-01-20 : 07:57:09
|
| Thanks, I will add a simple column with row number and create a view to export by. I know I will have to export 18 times and change the view each time but this is a one off job. |
 |
|
|
|
|
|