2021-08-27 11:32:21 +00:00
|
|
|
---
|
2022-08-26 19:07:59 +00:00
|
|
|
slug: /zh/sql-reference/statements/exchange
|
2022-04-10 23:08:18 +00:00
|
|
|
sidebar_position: 49
|
|
|
|
sidebar_label: EXCHANGE
|
2021-08-27 11:32:21 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# EXCHANGE语法 {#exchange}
|
|
|
|
|
|
|
|
以原子方式交换两个表或字典的名称。
|
|
|
|
此任务也可以通过使用[RENAME](./rename.md)来完成,但在这种情况下操作不是原子的。
|
|
|
|
|
2023-03-03 10:35:07 +00:00
|
|
|
:::note
|
2021-08-27 11:32:21 +00:00
|
|
|
`EXCHANGE`仅支持[Atomic](../../engines/database-engines/atomic.md)数据库引擎.
|
2023-03-03 10:35:07 +00:00
|
|
|
:::
|
2021-08-27 11:32:21 +00:00
|
|
|
|
|
|
|
**语法**
|
|
|
|
|
|
|
|
```sql
|
|
|
|
EXCHANGE TABLES|DICTIONARIES [db0.]name_A AND [db1.]name_B
|
|
|
|
```
|
|
|
|
|
|
|
|
## EXCHANGE TABLES {#exchange_tables}
|
|
|
|
|
|
|
|
交换两个表的名称。
|
|
|
|
|
|
|
|
**语法**
|
|
|
|
|
|
|
|
```sql
|
|
|
|
EXCHANGE TABLES [db0.]table_A AND [db1.]table_B
|
|
|
|
```
|
|
|
|
|
|
|
|
## EXCHANGE DICTIONARIES {#exchange_dictionaries}
|
|
|
|
|
|
|
|
交换两个字典的名称。
|
|
|
|
|
|
|
|
**语法**
|
|
|
|
|
|
|
|
```sql
|
|
|
|
EXCHANGE DICTIONARIES [db0.]dict_A AND [db1.]dict_B
|
|
|
|
```
|
|
|
|
|
|
|
|
**参考**
|
|
|
|
|
|
|
|
- [Dictionaries](../../sql-reference/dictionaries/index.md)
|