Using ROWLOCK in an INSERT statement (MS SQL)

Posted by RPS on Stack Overflow See other posts from Stack Overflow or by RPS
Published on 2010-05-18T12:45:39Z Indexed on 2010/05/18 12:51 UTC
Read the original article Hit count: 707

Filed under:

Would it be wise to use ROWLOCK on an insert statement that is copying large amounts of data and inserting it into the same table?

Ex)

INSERT INTO TABLE with (rowlock) (id, name) select newid, name) from TABLE with (nolock) where id = 1

Does anybody have recommendations on how to improve this statement, as I see when MS SQL gets busy it will end in Timeout Query returned for MS SQL.

© Stack Overflow or respective owner

Related posts about sql