简体   繁体   English

无法通过链接服务器将表添加到数据库

[英]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.

相关问题 通过链接服务器连接表 - Joining Table via Linked Server 通过链接服务器在远程服务器上创建数据库 - Create database on remote server via Linked Server 通过链接服务器查询master_files表 - Query master_files table via linked server 在Microsoft SQL中将Visual Fox Pro数据库添加为链接服务器 - Add visual fox pro database as a linked server in Microsoft SQL 将包含大量记录的表导出到链接服务器上的另一个数据库 - exporting a table containing a large number of records to to another database on a linked server 通过链接的服务器通过映射的网络驱动器从MS SQL Server 2012更新SQLite数据库 - Updating SQLite database from MS SQL Server 2012 via Linked Server over Mapped Network Drive SQL Server链接服务器-无法查看目标服务器的数据库表中的所有行 - SQL Server linked-server - cannot see all of the rows in target server's database table 无法将新记录添加到数据库 - Cant add new record to database 无法在Mysql数据库中创建表 - cant create table in Mysql database 有一个存储在 database1 中的触发器,当 database2 中的表被更新时触发,两个数据库都在链接服务器中? - Have a trigger stored in database1 that triggers when a table in database2 is updated, both databases in a linked server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM