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
 SQL Server Administration (2008)
 Trace Bulk INSERT

Author  Topic 

lappin
Posting Yak Master

182 Posts

Posted - 2011-06-03 : 07:43:50
Can anyone explain how to do a trace which will show the contents of a bulk insert?
I'm doing a bulk insert from webpage and I'm getting an error saying datatypes don't match but they seem correct. I'd like to see the actual data being sent and to which columns. I've ran a few traces but just get:
go
insert bulk MyTable ([ID] Int, [DT] DateTime, [Value] Float, [Flag] Char(1) COLLATE SQL_Latin1_General_CP1_CI_AS)
go

How do I see that data attempted to be inserted?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-03 : 07:55:10
Create a table with varchar columns and insert into that.
If that doesn't work then create a table with a single varchar column and insert ignoring the column delimiters.

After that you can check the data and find out what's wrong.
It's usually a god idea to add an identity to the table and index it so that you can access individual or ranges of rows easily.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

lappin
Posting Yak Master

182 Posts

Posted - 2011-06-03 : 09:26:59
That worked a treat thanks - now just to find out why one of the columns isn't being sent from the web page.
Go to Top of Page
   

- Advertisement -