all groups > sql server programming > october 2004 >
You're in the

sql server programming

group:

INSERT INTO Locksup PROC but OK in Query Analyzer


INSERT INTO Locksup PROC but OK in Query Analyzer Erik
10/24/2004 9:04:26 PM
sql server programming: I have SQL Similar to this:

--Put new records in Table3
Truncate Table Table3
Insert into table3
select * from STAGING where key1 not in (select distinct key1 from LIVE)

It works fine in SQL Analyzer, but when I create a stored procedure with the
same Sql code in it, its related process has RID Locks like crazy and just
hangs there...

This make no sense to me. I've tried running it in a BEGIN TRAN-COMMIT TRAN
and not difference.

Any idea why a stored proc would make a difference?

Re: INSERT INTO Locksup PROC but OK in Query Analyzer Ilya Margolin
10/25/2004 8:33:20 AM
Erik,

Try to UPDATE STATISTICS on all tables involved.

Ilya

[quoted text, click to view]

Re: INSERT INTO Locksup PROC but OK in Query Analyzer Kevin Stark
10/25/2004 9:15:39 AM
Can you do dirty reads? If so, maybe have a NOLOCK hint on STAGING and LIVE?

[quoted text, click to view]

AddThis Social Bookmark Button