【发布时间】:2016-02-06 13:48:59
【问题描述】:
我正在使用 SQL Server 2008。我有两个具有相同结构、分区架构/功能和相同文件组的 100 个分区表。
表结构:
Create table source_table
(
id int,
XmlData xml,
Partitionkey ([id]%(100)) As Persisted
)
Create table Destination_table
(
id int,
XmlData xml,
Partitionkey ([id]%(100)) As Persisted
)
要求:
Destination_table 有记录,但分区 23 为空。我需要将分区 23 记录从 Source_table 移动到 Destination_table。
ALTER TABLE Source_table
SWITCH partition 23 TO Destination_table partition 23
我收到一个错误
ALTER TABLE SWITCH 失败。 Destination_table 的目标分区 23 必须为空。
destination_table 的分区 23 已经为空。
Select count(1)
from destination_table
返回 0。
那为什么会出现这个错误呢?
【问题讨论】:
标签: sql-server database sql-server-2008