sql - LINKED Server does not return all rows -


This is a bit strange for me I have a script like the following

  declarare @maxcustId INT Select @maxcustId = Select maximum (customer ID) from customers * #temp from linkerver.DB.dbo Customers where CustomerId & gt; @maxcustId - Record the copy in the Local DB Custom Table Drop Table # Temp   

but sometimes #temp does not get all the records by breaking into the link.

Like I had maximum customer ID = 1138 in my local DB and when I move above the script, my floating table (which receives records from the linked server) ) CustoemrIds 1140, 1141 . The linked server has to 1160 subscribers in the #temp table, there is a record of up to 1160 , but the two records, namely 1140, 1141 < / Code>

I repeated that script and added the record to the 1141 #temp table on the 4th attempt, but record 1140 Was still missing.

Then I put the query on the local server to check the following server from the Record

  linker in the linked server. Choose. Db.dbo Customers where CustomerId = 1140   

does not return any records above the query

To verify this I went to the linked server and wrote the same query on the server from which I created the LINKED server.

  - This is the server that I am using as a linked server in my local server * Select from customers where CustomerId = 1140   

Custoemr 1140 was in DB, I was sure it would be there, but I will run the script above to verify it.

I come back to my local server and I turn on this query

  selecter from linkerver.DB.dbo Customer where CustomerId = 1140   

This time my linked server returns Customer 1140 which was not returning already.

I run the entire query again and now there are all records in my #tmp table

I am so confused why the first time the linked server did not return all the records

This is a long process sample that copies the records from the local server to the local server and due to this reason my local DB has less records than linked server DB.

  • < Local Server: SQL Server 2008 Web Edition with SP2
  • Provider <
  • <

    Login user details:

    • Server roll: public and sysadmin
    • User Mapping:
    • At any point in the query

Comments