Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL query giving wrong result on linked server
    primarykey
    data
    text
    <p>I'm trying to pull user data from 2 tables, one locally and one on a linked server, but I get the wrong results when querying the remote server.</p> <p>I've cut my query down to</p> <pre><code>select * from SQL2.USER.dbo.people where persId = 475785 </code></pre> <p>for testing and found that when I run it I get no results even though I know the person exists. (persId is an integer, db is SQL Server 2000 and dbo.people is a table by the way)</p> <p>If I copy/ paste the query and run it on the same server as the database then it works.</p> <p>It only seems to affect certain user ids as running for example <br></p> <pre><code>select * from SQL2.USER.dbo.people where persId = 475784 </code></pre> <p>works fine for the user before the one I want.</p> <p>Strangely I've found that</p> <pre><code>select * from SQL2.USER.dbo.people where persId like '475785' </code></pre> <p>also works but </p> <pre><code>select * from SQL2.USER.dbo.people where persId &gt; 475784 </code></pre> <p>brings back records with persIds starting at 22519 not 475785 as I'd expect.</p> <p>Hope that made sense to somebody</p> <p>Any ideas ?</p> <p>UPDATE: Due to internal concerns about doing any changes to the live people table, I've temporarily moved my database so they're both on the same server and so the linked server issue doesn't apply. Once the whole lot is migrated to a separate cluster I'll be able to investigate properly. I'll update the update once this happens and I can work my way through all the suggestions. Thanks for your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload