SQLTeam.com | Weblogs | Forums

Split SQl result


#1

I have a table with in excess of 11 million records. I need to export these to a csv file, but limit to 1 million records per file

Is there a way under management studio to show results in separate grids of 1 million or run different scripts to only return 1 million records.

I know I can do a TOP 1 million , to get the first 1 million records, but how do I then get the next 1 million , etc till the end of the table


#2

Is this a one time data dump


#3

yes,

in effect its a

Select Field1 from Table1


#4
select field1
  from table1
 order by field1
 offset 1000000 rows fetch next 1000000 rows only