WEB开发网
开发学院数据库MSSQL Server SQL Server 2008新功能 捕获数据变化(3) 阅读

SQL Server 2008新功能 捕获数据变化(3)

 2008-04-14 09:54:17 来源:WEB开发网   
核心提示: 执行结果ID,Name,Address,Salary,Bonushomesql2008(HOMEMAK):(0row(s)affected)homesql2008(HOMEMAK):(1row(s)affected)homesql2008(HOMEMAK):(1row(s)affected

执行结果

  ID,Name,Address,Salary,Bonus
  homesql2008(HOMEMAK):(0row(s)affected)
  homesql2008(HOMEMAK):(1row(s)affected)
  homesql2008(HOMEMAK):(1row(s)affected)
  homesql2008(HOMEMAK):(1row(s)affected)
  homesql2008(HOMEMAK):(1row(s)affected)
  homesql2008(HOMEMAK):(1row(s)affected)
  ID,Name,Address,Salary,Bonus
  1,DancingDoll,221,WestBroadst,
  Greenbay,Wisconsin,60000.0000,1000.0000
  2,RainbowDance,21,Eastst,
  Denville,NewJersey,68000.0000,1300.0000
  3,WaterDance,1,SouthBroadst,
  Quincy,Massachusetts,76000.0000,1600.0000
  4,MickeyMouse,5,Main,
  Greenbay,Wisconsin,120000.0000,12000.0000
  5,Ratyear,7,Newroad,
  Danbury,Connecticut,45000.0000,1600.0000
  homesql2008(HOMEMAK):(5row(s)affected)

第七步

更新及删除一些数据,如下:

  use[CDCDB]
  go
  UpdateEmployeesetname='test'whereid=5
  go
  DeleteEmployeewhereidin(3,4)
  Go

第八步

通过以下查询语句查看DDL和DML的变化。[参考图 Fig 1.0 and Fig 1.1]

  use[CDCDB]
  go
  select*fromcdc.ddl_history
  go

执行结果

  source_object_id,object_id,required_column_update,ddl_command,ddl_lsn,ddl_time
  565577053,597577167,0,AlterTableEmployeeaddAddressvarchar(500)
  ,0x000000360000006B0022,2008-02-0915:03:00.000
  565577053,597577167,0,AlterTableEmployeeaddSalarymoney
  ,0x000000360000007A0018,2008-02-0915:03:00.000
  565577053,597577167,0,AlterTableEmployeeaddBonusmoney
  ,0x00000036000000800018,2008-02-0915:03:00.000
  homesql2008(HOMEMAK):(3row(s)affected)

上一页  1 2 3 4  下一页

Tags:SQL Server 新功能

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接