all groups > sql server programming > july 2005 >
You're in the

sql server programming

group:

dts a lot of data between 2 tables



dts a lot of data between 2 tables Hassan
7/12/2005 9:50:44 PM
sql server programming: Id like to dts a lot of data( around 100GB) from one table to another.. How
can I do so without blowing the Tlog ? Basically I guess I need to commit
more frequently and dont know how to do so

Or maybe I could use an insert select statement to do this instead of DTS

But how can I commit after a few records are inserted

Basically I want to insert all data to this new table from a table based on
a date column

So i want to select all data from a table that has date < 7/1/05 and
populate the new table and insert maybe 50000 rows at a time and commit so
the log does not blow up..

Can someone help ?

Re: dts a lot of data between 2 tables Hassan
7/12/2005 10:54:20 PM
Assuming this statement SELECT <column list> FROM Table2 WHERE col >=
'20050701' AND col <'20050702' has say 5000 rows and I want to insert 1000
at a time and commit, then how can I do so.

I understand the rowcount 1000 and doing a while loop, but how do i keep
track of the 1000 rows that are inserted so as to not avoid inserting them
again ?


[quoted text, click to view]

Re: dts a lot of data between 2 tables Hassan
7/12/2005 11:50:58 PM
I guess Im not clear... :-(

[quoted text, click to view]

Re: dts a lot of data between 2 tables Uri Dimant
7/13/2005 8:47:37 AM
Hassan
INSERT INTO Table1 (column list)
SELECT <column list> FROM Table2 WHERE col >= '20050701' AND col <'20050702'

This script is written by Vays
See if it helps you as well

SET ROWCOUNT 1000
WHILE 1 = 1
BEGIN
UPDATE Basket
SET Inactive = 1
WHERE ItemAddedDate < DATEADD(dd, -30, CURRENT_TIMESTAMP) AND Inactive = 0

IF @@ROWCOUNT = 0
BEGIN
BREAK
END
ELSE
BEGIN
------Or doing T-LOG Backup
CHECKPOINT
END
END

SET ROWCOUNT 0



[quoted text, click to view]

Re: dts a lot of data between 2 tables Uri Dimant
7/13/2005 9:46:01 AM
Hassan
SELECT TOP 1000 clause..........

[quoted text, click to view]

Re: dts a lot of data between 2 tables Uri Dimant
7/13/2005 10:18:00 AM
Its OK:-)
[quoted text, click to view]

RE: dts a lot of data between 2 tables mark baekdal
7/14/2005 1:50:08 AM
use select into to create the table with the data in one statement. That way
you'll get speed and very little in the transaction log. Think of the
transaction log as a recording of all the SQL Server has to do to roll back a
transaction. The less granular the statement, the less that goes into the
transaction log. With select into all that is required to rollback would be
drop table. Insert statement require loads of logging to guareentee a safe
rollback facility. Once you done the select into you can create all your
constraints and indexes which is again very fast due to minimal transaction
logging.


regards,
Mark Baekdal
http://www.dbghost.com
http://www.innovartis.co.uk
+44 (0)208 241 1762
Build, Comparison and Synchronization from Source Control = Database change
management for SQL Server




[quoted text, click to view]
AddThis Social Bookmark Button