Executing a query on remote server

  • Hi

    While executing a query on the remote server getting error

    select * from [remoteservername].[Dbname].[Username].[tablename] (Nolock)

    Server: Msg 7377, Level 16, State 1, Line 1

    Cannot specify an index or locking hint for a remote data source.

    But when I run the same query like this

    select * from [remoteservername].[Dbname].[Username].[tablename] Nolock

    It gives the result.

    What is the difference between the two??Why the first query gives error and the second query gives a result.

     

     

     

  • That would be because it's using Nolock as an alias to the table on the remote server.

    So you would be able to have your query look like ,

    select Nolock.* from [remoteservername].[Dbname].[Username].[tablename] Nolock

     

    --------------------
    Colt 45 - the original point and click interface

Viewing 2 posts - 1 through 1 (of 1 total)

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