sql - Doing BULK Insert SUSPENDED With Wait Type LCK_M_RIn_LN -


i'm having awful problems doing bulk insert. i'm using sqlbulkcopy insert number of rows table. @ first, timeout exception. so, set sqlbulkcopy's bulkcopytimeout ridiculous[?] 1800 seconds. exception wouldn't thrown (yet). so, checked activity monitor (as suggested here: timeout expired. timeout period elapsed prior completion of operation or server not responding. statement has been terminated) ms server management studio , saw bulk insert's task status suspended wait type of lck_m_rin_ln.my code goes this:

using sqlcon sqlconnection = connection.connect()    dim sqlbulkcopy new sqlbulkcopy(sqlcon, sqlbulkcopyoptions.checkconstraints ,    sqlbulkcopyoptions.firetriggers ,    sqlbulkcopyoptions.keepnulls ,    sqlbulkcopyoptions.keepidentity, sqltran)     sqlbulkcopy.bulkcopytimeout = 1800 ' ridiculous?    sqlbulkcopy.batchsize = 1000    sqlbulkcopy.destinationtablename = destinationtable    sqlbulkcopy.writetoserver(datatableobject)     sqltran.commit() end using 

i have been searching solutions in web, no avail. although have found defintion of lck_m_rin_ln:

occurs when task waiting acquire null lock on current key value, , insert range lock between current , previous key. null lock on key instant release lock. lock compatibility matrix, see sys.dm_tran_locks (transact-sql).

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

but it's not helping. may me out. deepest gratitude.

edit

i think it's because of keepidentity attribute because primary key auto incremented. according sqlbulkcopy insert identity column. i'll see if fixes issue.

edit 2

i don't know what's happening bulk insert worked fine when tested on management studio (using direct transact-sql). don't know. maybe it's sqlbulkcopy. when checked on activity monitor, query generated this:

insert bulk tablename ([columnname] int)

edit 3

i forgot write i'm using entity framework copied code (translated c# vb, actually) create datatable entity object since entitydatareader available c# (which distressed me). but, anyway. trashed sqlbulkcopy thing , stored values in xml because when @ it, realized did not need values inside database.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -