Question

I need to transfer a table daily. Table name is changing every day, so i should use script to get the tableName.

There is a job step which transfers data from sourceTable to destinationTable created by using T-SQL query. sourceTable and destinationTable are in different servers. Linked Server works fine.

If i execute the same query in sql serer management studio, it works fine. But when job executed at this step i see this message:

Executed as user: NT AUTHORITY\SYSTEM. Login Failed for user "NT AUTHORITY\ANONYMOUS LOGON". The step failed.

Both sql servers are 2008 R2 version and linked to each other.

You may advise some other methods instead using T-SQL.

Any help would be appreciated.

Was it helpful?

Solution 2

I couldn't solve this problem with linked servers.

Instead of linked servers i used these steps:

  1. rename x to x_temp
  2. use SSIS package (which is much faster than linked server query) to move all data from x_temp to other server.
  3. rename x_temp to x_dd_mm_yyyy

OTHER TIPS

This is because of "2-Hops" issue with SQL server. I was able to fix this issue in the two ways: 1. Still using Linked Servers: On the remote server create user with SQL Server authentication and give all needed permissions. Then open linked server properties and mapping for your account to the user that you just created, like this: enter image description here

After that you will be able to run your scripts

  1. Using openrowset:

    SELECT a.* FROM OPENROWSET('SQLNCLI', 'Server=;Trusted_Connection=yes;', 'SELECT * from .dbo.') AS a;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top