zoukankan      html  css  js  c++  java
  • tableDiff的用法(转)

    --创建测试表  
    CREATE TABLE Tmp  
    (  
     ID int PRIMARY KEY,  
     Account varchar(32),  
     CharName varchar(32)  
    )  
    GO  
     
    --插入测试数据  
    INSERT Tmp  
    SELECT 1,'account1','CharName1'  
    UNION ALL SELECT 2,'account2','CharName1'  
    UNION ALL SELECT 3,'account3','CharName1'  
    GO  
     
    --创建Check表  
    CREATE TABLE Tmp_Check  
    (  
     ID int PRIMARY KEY,  
     Account varchar(32),  
     CharName varchar(32)  
    )  
    GO  
    INSERT Tmp_Check  
    SELECT 1,'account11','CharName11' 


     使用CMD到

    C:\Program Files\Microsoft SQL Server\100\COM有tablediff.exe 命令

    运行

    tablediff -sourceserver "localhost" -sourcedatabase "kk" -sourceschema "dbo" -sourcetable "Tmp" -sourceuser "sa" -sourcepassword "1-destinationserver "localhost" -destinationdatabase "kk" -destinationschema "dbo" -destinationtable "Tmp_Check" -destinationuser "sa" -destinationpassword "1-f "c:\Test.sql"

     执行结果

     

    -- Host: localhost
    --
     Database: [kk]
    --
     Table: [dbo].[Tmp_Check]
    UPDATE [dbo].[Tmp_Check] SET [Account]=N'account1',[CharName]=N'CharName1' WHERE [ID] = 1
    INSERT INTO [dbo].[Tmp_Check] ([Account],[CharName],[ID]VALUES (N'account2',N'CharName1',2)
    INSERT INTO [dbo].[Tmp_Check] ([Account],[CharName],[ID]VALUES (N'account3',N'CharName1',3)

     
  • 相关阅读:
    Contains Duplicate
    Valid Anagram
    Invert Binary Tree
    Same Tree
    代理模式——java设计模式
    单例模式——java设计模式
    关于春招自己感到很失落这件事
    Collections.sort()中的mergeSort归并排序
    腾讯云搭建日志收集系统
    centos7 mysql
  • 原文地址:https://www.cnblogs.com/zping/p/2636110.html
Copyright © 2011-2022 走看看