sql server programming:
SQL 2K
I got a update statement (given below).
MyTable - 3 million rows
[commondata].[dbo].racurrencyconversionrates - 84 rows
Update is performing on a server with multiple databases, 'commondata' is a
different db.
The update is like this (@ Server - Myserver, db - Mydb)
update mytable
set currency_rate_cad = rate ,
bill_amt_usd = bill_amt_local,
bill_amt_cad = bill_amt_local /rate,
rate_usd = rate_local,
rate_cad = rate_local /rate
from [commondata].[dbo].racurrencyconversionrates
where
mytable.country = 'usa' and bill_amt_local >0 and
effectivedate = (select max(effectivedate) from
[commondata].[dbo].racurrencyconversionrates
where currencytype = 'cad' and effectivedate <= mytable.charge_date)
This update cause a LOCK to 'system' or 'sa' user with status 'BACKGROUND'
(Process Info screen ) .
I waited over 4 hrs but UPDATE did not complete and forced to kill the
process.
Sometime I get error
"[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheckForData
(CheckforData()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.
Connection Broken "
Now , I am updating this in a batch of 100000 and each set completing less
than 2 minutes.
Please help
Regards
MS