Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007

    Unanswered: {Select [column] from [table] nolock where... } - Dont work!!


    I want do a query selecting from system catalog like this:

    SELECT [alias1].[column] FROM [table1] AS [alias1], [table2] AS [alias2] WITH (NOLOCK) WHERE [alias1].[column] = '%'....

    ...but it give a syntax error from 'with' or, if a try this...:

    SELECT [alias1].[column] FROM [table1] AS [alias1], [table2] AS [alias2] NOLOCK WHERE [alias1].[column] = '%'....

    ...give another syntax error from 'nolock'... I need nolock selection, because at many times, without nolock, that query give me a deadlock situation...

    This problem ocorrer in ASE 12.x.x and SQL2005.

    Another thing. A query like this:

    SELECT [column] FROM [table1], [table2] NOLOCK WHERE [column] = '%'....

    ..I dont have problem.. Can I make a Alias and use nolock at a query???

    PSą: Sorry my english
    PS˛: my first post!!!

  2. #2
    Join Date
    Nov 2007


    I was looking at sybase manual and the syntax command to that is:

    select [all | distinct] select_list
    [into [[database.]owner.] table_name]
    [from [[database.]owner.]{view_name|table_name
    [(index {index_name | table_name}
    [parallel [degree_of_parallelism] ]
    [prefetch size] [lru | mru])]}
    [holdlock | noholdlock] [shared]
    [,[[database.]owner.]{view_name| table_name
    [(index {index_name | table_name}
    [parallel [degree_of_parallelism] ]
    [prefetch size] [lru | mru])]}
    [holdlock | noholdlock] [shared]]...]

    [where search_conditions] ...

    Thank you, at all

  3. #3
    Join Date
    Sep 2003
    Glad you found the syntax Hope you are using it for dirty reads and your SQL doesnt require any data integrity.

    For others benefits.

    holdlock is isolation level 3
    noholdlock is isolation level 1

    Dirty Nonrepeatable reads Phantom reads
    Level 0 yes yes yes
    Level 1 no yes yes
    Level 2 no no yes
    Level 3 no no no

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts