code_junkie

SQL Insert with large dataset

Nov 13th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. INSERT INTO thisTable
  2. SELECT TOP 100 * FROM anotherTable;
  3.  
  4. INSERT INTO TableInserted
  5. SELECT *
  6. FROM (
  7. SELECT *,
  8. ROW_NUMBER() OVER (ORDER BY ID) AS RowNumber
  9. FROM TableSelected
  10. ) X
  11. WHERE RowNumber BETWEEN 101 AND 200
Add Comment
Please, Sign In to add comment