---
title: "SQLserver局部数据备份"
author: "dazhi2010"
date: "2012-03-26T15:24:33Z"
tags: []
categories: ["数据库"]
slug: "sqlserver"
draft: false
lastmod: "2012-02-15T16:02:30Z"
id: 1407328
url: "https://dazhi4java.iteye.com/blog/1407328"
---

--delete from zd\_bg\_zh\_copy where rq between to\_date('2011-11-1', 'yyyy-mm-dd') and to\_date('2011-12-31', 'yyyy-mm-dd')

1\.

insert into zd\_bg\_zh\_copy  
select * from zd\_bg\_zh where rq between to\_date('2011-11-1', 'yyyy-mm-dd') and to\_date('2011-12-31', 'yyyy-mm-dd')--将需要备份的数据添加到另一个表中,结构要一样才行

2\.  
select * into zd\_bg\_zh\_copy from zd\_bg\_zh where rq between to\_date('2011-11-1', 'yyyy-mm-dd') and to\_date('2011-12-31', 'yyyy-mm-dd')--如果没有事先建好结构一样的表，会自动创建一个这样的表