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 2008 Forums
 Transact-SQL (2008)
 how long

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-10 : 06:21:05
Doing a big insert from pro to Dev on a table which has 50 million records.
How can I find out how many records or how long is left before finishing the insert.
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-10 : 06:24:14
how are you doing insert? is it through ssis export/import or are you using t-sql script?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2011-11-10 : 06:25:19
insert into in query analyser.
How about sp_spaceused ?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-10 : 10:07:28
nope it gives disk space used



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-11-10 : 11:18:21
Dunno if it will work (i.e. whether it will be able to see ANY of the new rows), but:

SELECT COUNT(*) FROM MyTargetTable WITH (NOLOCK)

??
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-11-10 : 13:30:13
quote:
Originally posted by Kristen

Dunno if it will work (i.e. whether it will be able to see ANY of the new rows), but:

SELECT COUNT(*) FROM MyTargetTable WITH (NOLOCK)

??



yeah that will work

why didn't you use bcp?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-11-10 : 13:47:50
quote:
Originally posted by Kristen

Dunno if it will work (i.e. whether it will be able to see ANY of the new rows), but:

SELECT COUNT(*) FROM MyTargetTable WITH (NOLOCK)

??

better:

SELECT rows FROM sys.partitions WHERE object_id = object_id ('YourTable');
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-11-10 : 13:50:44
You could also try:

SELECT rows FROM sys.partitions WHERE index_id<2 AND object_id=OBJECT_ID('myTable')

That will be faster than doing a count on the table.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-11-10 : 14:19:31
Blimey, is that kept up to date as individual rows are inserted during a batch ?

Always amazed me what SQL finds CPU-time available to do behind the scenes!
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-11-10 : 15:12:18
quote:
Blimey, is that kept up to date as individual rows are inserted during a batch ?
Yeah, there's a lot of neat things you can do with the DMVs.
quote:
Always amazed me what SQL finds CPU-time available to do behind the scenes!
You need to watch Dr. DeWitt's PASS keynotes, especially from 2010, where he discusses how query optimization works. You'll be amazed that it can process a query AT ALL considering how much work has to be done.
Go to Top of Page
   

- Advertisement -