Teradata:如何备份使用标识列的表? [英] Teradata: How to back up a table that uses an identity column?

查看:195
本文介绍了Teradata:如何备份使用标识列的表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Teradata中,我一直在为表进行备份的方式是这样的:

In Teradata, the way I've been doing backups for tables is like this:

create table xxx_bak as xxx with data

很好,但我刚刚发现这不适用于带有标识列的表.

Works great, but I have just discovered that this doesn't work for tables with identity columns.

我需要一个备份方法,该方法可以复制一个表且其数据完整无缺,以便在我弄乱某些数据时可以将其回滚.

I need a backup method that can duplicate a table with its data intact so that I can roll it back in case I mess up some data.

推荐答案

经过一年半的时间,我终于找到了解决这个问题的灵巧解决方案:

After over a year and a half, I've finally found a slick solution to this issue:

create table mydb.mytablebackup as 
(select * from (select * from mydb.mytable) x) 
with data;

请确保限定最里面的子查询,否则它将不起作用.

Be sure to qualify the innermost subquery or it won't work.

这篇关于Teradata:如何备份使用标识列的表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆