0

I am trying to add a table to an existing database in a linked server, but getting:

The object name 'name.mycompany.com.DataAg.dbo.Secure30AWSMap' contains more than the maximum number of prefixes. The maximum is 2.

What am I doing wrong? Based on this link it seems like I cant use a 4 part name. However this link sounds like it might be a workaround using an Exec statement. Is there a way to solve this without messing with the linked servers DDL though?

create table [name.mycompany.com].[DataAg].[dbo].[Secure30AWSMap]([servername] [nvarchar](50),[username] [nvarchar](50),[full_name][nvarchar](50),[awscoid][nvarchar](50))
Rilcon42
  • 9,584
  • 18
  • 83
  • 167

2 Answers2

1

if RPC is configured true for linked server, it can help.

EXEC('create table [DataAg].[dbo].[Secure30AWSMap]([servername] [nvarchar](50),[username] [nvarchar](50),[full_name][nvarchar](50),[awscoid][nvarchar](50))') AT [name.mycompany.com]
RGhanbari
  • 134
  • 5
0

You need to go to your linked server and manually create the table and then try this.

  INSERT INTO [linkedserver].[database].[dbo].[table]
SELECT servername, username, fullname, awscoid
FROM [database].[dbo].[table]
WHERE ID = userID;
Buchiman
  • 320
  • 5
  • 18