Re: SELECT is fine, but INSERT gets Timeout Expired



Slim,

Of course an INSERT can take longer than a SELECT. I suspect that you are
being blocked by some lock in the system and your INSERT is timing out after
30 seconds. Things to do:

1 - Do your insert and then run (in query analyzer) sp_who. Look to see if
your process (spid) is being blocked by another. If so, in the BLK column
will be the spid that is getting in your way. Check that process to see it
is doing. That may be where a change is needed.

2 - Increase the timeout from the default of 30 seconds.

RLF


"Slim" <Slim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F14E5D52-167E-4259-80C0-1521E4062A64@xxxxxxxxxxxxxxxx
>I have a computer A in Domain AA,
> and have SQL Server installed on computer B in Domain BB.
>
> When I connect from computer A to SQL intance in B using script or C#
> program, SELECT statements work fine, but when I try INSERT I get "Timeout
> expired." Does anyone know what I can try to remedy the situation?
>
> For example, I have following connectionstring in vbs:
>
> oCn.ConnectionString = "Provider=sqloledb;Data
> Source=ipaddress,1433;Network
> Library=DBMSSOCN;Initial Catalog=databasename;User ID="& sLogin &
> ";Password="& sPwd & ";"
>
> Following works fine:
> oCn.open
> oRs.Open "exec spgetstatus", oCn
> (spgetstatus stored proc simply does select from a table),
>
> But following I get error:
> oRs.Open "Insert into tblTestTable (TMAName) values ('from script')", oCn
>
> I get "Microsoft OLE DB Provider for SQL Server: Timeout expired" error.
>
> Any suggestions on what I need to change from the connecting machine
> and/or
> on the sql server installed machine??
>
> Thank you!!


.


Loading