MSSQL is good database.   Unlike as Oracle,  it seems that can not backup sqlserver databasee tables one by one.

However there is always way.

Thanks to

I  did modify and then , it can auto baclkup table one by one no matter how many table is.

Here is script:

-- SQL Table Backup
-- Developed by DBATAG, www.DBATAG.com
DECLARE @table VARCHAR(128),
@file VARCHAR(255),
@cmd VARCHAR(512)

declare @m int
declare @n int
--declare @tmp nvarchar(MAX)

declare @tableList TABLE (id int IDENTITY(1,1) NOT NULL,contents VARCHAR(128) NOT NULL)
DECLARE @SQL2 VARCHAR(MAX)

SET NOCOUNT ON
set @SQL2='select DB_NAME()+''.'' +schema_name() + ''.''+ name from sys.tables where type=''U'''

INSERT INTO @tableList (contents) exec (@SQL2)

set @m=(select count(*) from @tableList)
set @n=1

while @n<=@m
begin
set @table=(select contents from @tableList where id=@n)

--SET @table = 'AdventureWorks.Person.Contact' -- Table Name which you want to backup
--SET @table = 'MES.dbo.Sys_Group'
--SET @table = 'select name from sys.tables where type='U' order by 1'
SET @file = 'C:\backup\' + @table + '_' + CONVERT(CHAR(8), GETDATE(), 112) -- Replace C:\MSSQL\Backup\ to destination dir where you want to place table data backup
+ '.bcp'
SET @cmd = 'bcp ' + @table + ' out ' + @file + ' -n -T '
EXEC master..xp_cmdshell @cmd
set @n=@n+1
end

Bingo

How to backup on MSSQL by table level ?的更多相关文章

  1. flush table with read lock的轻量级解决方案[原创]

    为什么要使用FTWRL   MySQL dba在日常工作中,数据备份绝对是工作频度最高的工作内容之一.当你使用逻辑方式进行备份(mydumper,mysqldump)或物理方式进行备份(percona ...

  2. Backup and Recovery Types

    Physical(Raw) and Logical Backup: 1.Physical backups consist of raw copies of the directories and fi ...

  3. flush table with read lock的轻量级解决方案

    为什么要使用FTWRL   MySQL dba在日常工作中,数据备份绝对是工作频度最高的工作内容之一.当你使用逻辑方式进行备份(mydumper,mysqldump)或物理方式进行备份(percona ...

  4. RMAN BACKUP

    转自 RMAN BACKUP backup terminology Using the RMAN BACKUP Command to Create Backups Server-Managed Con ...

  5. How to changes to Table & EDT Relations[AX2012]

    Well I hope everyone is having a fine week so far. Oh Wednesdays, the furthermost point between two ...

  6. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

  7. MySQL Error Number 1005 Can’t create table(Errno:150)

    mysql数据库1005错误解决方法 MySQL Error Number 1005 Can’t create table ‘.\mydb\#sql-328_45.frm’ (errno: 150) ...

  8. 102. Binary Tree Level Order Traversal + 103. Binary Tree Zigzag Level Order Traversal + 107. Binary Tree Level Order Traversal II + 637. Average of Levels in Binary Tree

    ▶ 有关将一棵二叉树转化为二位表的题目,一模一样的套路出了四道题 ▶ 第 102 题,简单的转化,[ 3, 9, 20, null, null, 15, 7 ] 转为 [ [ 15, 7 ] , [ ...

  9. 转 RMAN: RAC Backup, Restore and Recovery using RMAN

    PURPOSE The purpose of this document is to give a quick guide for using RMAN on RAC databases. We wi ...

随机推荐

  1. dropLoad.js移动端分页----Vue数据每次清空累加

    dropLoad.js移动端使用 1.需要引入  dropload   必要的两个文件dropload.css .dropload.min.js 此案例在vue项目中使用过程: var vm = ne ...

  2. 吴裕雄 python 神经网络——TensorFlow图片预处理

    import numpy as np import tensorflow as tf import matplotlib.pyplot as plt # 使用'r'会出错,无法解码,只能以2进制形式读 ...

  3. Python学习(四)—— 列表和元组的类中方法

    列表 list:用中括号括起来,用“,”分割每个元素,列表中的元素可以是 数字.字符串.列表.布尔值......所有东西,可以说就是一个“集合” li = [1,3,5,'alex','age',[' ...

  4. JupyterLab远程访问配置方法(CentOS7)

    下载 Anaconda3安装包,并执行安装命令: bash Anaconda3-2019.07-Linux-x86_64.sh 确定安装并初始化: Do you wish the installer ...

  5. PCC值average pearson correlation coefficient计算方法

    1.先找到task paradise 的m1-m6: 2.根据公式Dy=D1* 1/P*∑aT ,例如 D :t*k1   a:k2*k1: Dy :t*k2 Dy应该有k2个原子,维度是t: 3.依 ...

  6. 分布式系统(二) --SOA 以及一些网络通信协议TCP/UDP SYN攻击

    SOA(面向服务的架构):Service Oriented Architecture面向服务的架构.也就是把工程拆分成服务层.表现层两个工程.服务层中包含业务逻辑,只需要对外提供服务即可.表现层只需要 ...

  7. 微信小程序媒体音乐API更新小记,以及音乐外链制作方法

    假期开发微信小程序玩的时候发现音乐播放功能,但是教程中的旧版API已经不能成成功打开 官方文档写的很清楚,旧版接口不再维护,使用新版接口,换API后,又出现了新的问题,虽然没有报错信息,但是播放器闪退 ...

  8. 解决1130-host'192.168.2.137'is not allowed to connect to this mysql server报错问题

    连接数据库服务器出现1130-host'192.168.2.137'is not allowed to connect to this mysql server错误, 这个问题是因为在数据库服务器中的 ...

  9. Oracle 设置NLS_CHARACTERSET字符集

    Oracle 设置NLS_CHARACTERSET字符集 sqlplus "/ as sysdba"SQL> SHUTDOWN IMMEDIATE;SQL> START ...

  10. C# MD5加密-MD5Helper

    原文地址:https://ken.io/note/csharp-md5 一.前言 MD5说明http://zh.wikipedia.org/wiki/MD5 .NET MD5类 官方文档&示例 ...