NOLOCk hint question

  • Hi,

    I have a question whether can I use NOLOCK hint in SELECT clause of the INSERT statement like this one ?

    INSERT INTO table3 (

    AttributeID,

    IssuerID

    )

    SELECT distinct

    fm.AttributeID,

    asp.SecurityID AS IssuerID,

    FROM table1 a WITH (NOLOCK) - IS this ok ?

    INNER JOIN table2 asp WITH (NOLOCK) - IS this ok ?

    ON a.PolicyID = asp.PolicyID

    Also, how about select into statement ? ???

    Thank you,

    V

  • yes, both of those statements are just fine. Be aware of the consequences you could face by using nolock (dirty reads, etc.)

  • Yes, you can use it but downside is that, because the statement does not issue any locks against the tables being read, some "dirty," uncommitted data could potentially be read.

    [font="Verdana"]--www.sqlvillage.com[/size][/font]

  • Makes sense..

    Thank you,

    V

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply