dbTalk Databases Forums  

BulkInsert: Record Count

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss BulkInsert: Record Count in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Karthik R
 
Posts: n/a

Default BulkInsert: Record Count - 10-04-2004 , 01:25 PM






Hi

I am using DTS Bulk Insert task to load the data from flat files to
SQL Server tables. How can i get the no. of records that is inserted
from the Bulk Insert task? I can get the record count using count(*)
but i should be getting it from Bulk Insert task also.

The problem with Select count(*) is - it takes considerable time to
execute!
Sometimes - I can use EXEC sp_spaceused to get the record counts
faster than SELECT count(*) approach.

Any help here will be of great use!

Thanks in advance

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: BulkInsert: Record Count - 10-04-2004 , 01:53 PM






Why should you be getting it from the Bulk Insert task?

What about

declare @i int
set nocount on
BULK INSERT T FROM 'c:\File1.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
set @i = @@rowcount

print @i




--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.Konesans.com


"Karthik R" <dtsguy1 (AT) rediffmail (DOT) com> wrote

Quote:
Hi

I am using DTS Bulk Insert task to load the data from flat files to
SQL Server tables. How can i get the no. of records that is inserted
from the Bulk Insert task? I can get the record count using count(*)
but i should be getting it from Bulk Insert task also.

The problem with Select count(*) is - it takes considerable time to
execute!
Sometimes - I can use EXEC sp_spaceused to get the record counts
faster than SELECT count(*) approach.

Any help here will be of great use!

Thanks in advance



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.