[英]Cant add table to database via linked server
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.
对象名称“ name.mycompany.com.DataAg.dbo.Secure30AWSMap”包含的前缀数量超过了最大数量。 The maximum is 2.
最大值为2。
What am I doing wrong? 我究竟做错了什么? Based on this link it seems like I cant use a 4 part name.
基于此链接 ,看来我不能使用4部分名称。 However this link sounds like it might be a workaround using an Exec statement.
但是, 此链接听起来像是使用Exec语句的解决方法。 Is there a way to solve this without messing with the linked servers DDL though?
有没有一种方法可以解决此问题而又不会弄乱链接服务器DDL?
create table [name.mycompany.com].[DataAg].[dbo].[Secure30AWSMap]([servername] [nvarchar](50),[username] [nvarchar](50),[full_name][nvarchar](50),[awscoid][nvarchar](50))
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;
如果为链接服务器将RPC
配置为true
,则可以提供帮助。
EXEC('create table [DataAg].[dbo].[Secure30AWSMap]([servername] [nvarchar](50),[username] [nvarchar](50),[full_name][nvarchar](50),[awscoid][nvarchar](50))') AT [name.mycompany.com]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.