Is it Possible !

  • I am trying to use the nolock option for an sql statement. but i get the error as

    Incorrect syntax near the keyword 'with'

    the statement i am using is

    select * from inner join dbo.cataddon_reportquery on cataddon_reportquery.userid = .loginname with (nolock)

    if i am not using the inner join then its working well. is there any work around for this.

    I mean i don't want locks to be created on any tables in the statement.

  • select * from with (nolock) inner join dbo.cataddon_reportquery with (nolock) on cataddon_reportquery.userid = .loginname

  • Preface the entire SELECT with:  SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED and forget the individual table settings.

  • Thanks very much Lee Dise, But setting

    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

    how does this have effect on other queries.

    does this stand good for the immediate query or on all further queries.

     

  • Thanks RGR'us. it works fine.

    Thanks very much Lee Dise, But setting

    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

    how does this have effect on other queries.

    does this stand good for the immediate query or on all further queries.

  • Turn it off when you want it off with:  SET TRANSACTION ISOLATION LEVEL READ COMMITTED

    Its effect stays on until you tell it otherwise.

    If you want to lock only individual tables, you need to revert to the other method.

Viewing 6 posts - 1 through 5 (of 5 total)

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