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
 General SQL Server Forums
 New to SQL Server Programming
 INSERT HELP

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2006-04-28 : 10:15:57
I have a file with around 140k Records in the file and there is a table with around 200 columns in the and the total length of all the columns together is 2000 bytes approx. There is a .NET Application which reads the file and inserts into the database and in the .NET application there are using a Insert Query

INSERT INTO TableName ( col1 , Col2 ,....coln ) VALUES ( Val1 , val2 ..... etc).

The app which does that hangs after inserting some records. All I can see in when I run the SP_WHO2 is that SPID is AWAITING COMMAND

What is a good way to debug this. and is this a good way of using the Adhoc Query to insert data to the database
or Is there a better way to do this.

Thx
Venu

nr
SQLTeam MVY

12543 Posts

Posted - 2006-04-28 : 10:33:15
Use bulk insert if possible.


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

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-04-28 : 12:42:48
Just some suggestions

-- Use a stored procedure to do the task and call it from front end (.Net)
-- if still takes lot of resources, do it by batches.

Srinika
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-04-28 : 14:20:55
You can turn the SQL Profiler on to see what is actually coming across. Since you are trying to debug I would probably turn on the event for SQL statement Start and Complete so that you can see if each command is completing as they should or if perhaps the application is starting the commands but they aren't getting finished or something. You would also have the commands then in the Profiler so that you could copy/paste them into the Query Analyzer to see if they are failing perhaps for some reason.

Good luck,
Dalton
Go to Top of Page
   

- Advertisement -