2010. 6. 4. 01:13

복제::LOB DataType 제한

  1. --CREATE TABLE [dbo].[odd_repl_data_snapshot](
    -- [gd_no] [varchar](10) NOT NULL,
    -- [org_data] [text] NULL,
    --) --ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
  2. /*
    update  a
    set a.org_data = b.org_data
    from repl_source.dbo.odd_repl_data_snapshot a with(nolock)
    inner join repl_source.dbo.dup_data b with(nolock) on a.gd_no = b.gd_no
    */
  3. declare @ptr varbinary(16)
    declare @str varchar(max)
    select @str = org_data
    from repl_check.dbo.dup_data with(nolock) where gd_no = '117368652'
  4. select @ptr= textptr(org_data)
    from repl_check.dbo.odd_repl_data_snapshot with(nolock)
    where gd_no = '117368652'
    writetext repl_check.dbo.odd_repl_data_snapshot.org_data @ptr with log @str
  5. --
    --
    update  a
    set a.org_data =  b.org_data
    from repl_source.dbo.test_varcharmax a with(nolock)
    inner join repl_check.dbo.dup_data b with(nolock) on a.gd_no = b.gd_no

  6. --truncate table repl_target.dbo.odd_repl_data_snapshot
    --truncate table repl_target.dbo.test_varcharmax
  7. select --a.gd_no , substring (b.org_data , b.break_idx , 20) , substring(b.org_data , b.break_idx , 20)
    a.gd_no , datalength(b.org_data) , datalength(a.org_data)
    from repl_target.dbo.odd_repl_data_snapshot a with(nolock)
    inner join repl_source.dbo.dup_data b with(nolock) on a.gd_no = b.gd_no
    where b.seqno <= 3

  8. select --a.gd_no , substring (b.org_data , b.break_idx , 20) , substring(b.org_data , b.break_idx , 20)
    a.gd_no , datalength(b.org_data) , datalength(a.org_data) , datalength(c.org_data)
    from repl_target.dbo.test_varcharmax a with(nolock)
    inner join repl_source.dbo.test_varcharmax c with(nolock) on a.gd_no = c.gd_no
    inner join repl_source.dbo.dup_data b with(nolock) on a.gd_no = b.gd_no
    where b.seqno <= 3

  9. update repl_target.dbo.odd_repl_data_snapshot set org_data= '' where gd_no = '117368652'
  10. --
    --CREATE TABLE [dbo].[test_varcharmax](
    -- [gd_no] [varchar](10) NOT NULL,
    -- [org_data] [varchar](max) NULL,
    --
    --)
  11. backup database repl_check to disk='e:\repl_source_full.BAK' with stats
    go
    backup database repl_target to disk='e:\repl_target_full.BAK' with stats

 

이 글은 스프링노트에서 작성되었습니다.

'Replication' 카테고리의 다른 글

복제::스키마 옵션  (0) 2012.01.30
복제::숨겨진 저장프로시저 확인  (0) 2011.01.16
복제::#5 구현&삭제 스크립트  (0) 2010.06.04
복제::머지복제에러  (0) 2010.06.04