sql server 2005 批量导入导出

  • 来源: 互联网 作者: 若水   2008-03-18/13:53
  • declare @CMD_STR varchar(100)
    declare @i int
    declare @memo nvarchar(50)
    set @memo='数据分离'
    set @i=0
    while @i<=153
    begin

    insert into t
    select top 15000 *
    from dbo.gceclub_member_email

    select @CMD_STR= 'bcp jive.dbo.t' + ' out C:\TDDOWNLOAD\test\' + @memo+cast(@i as nvarchar(20)) + '.xls'+ ' -c -S 127.0.0.1 -U sa -P bizcom'                   
    EXEC master.dbo.xp_cmdshell @CMD_STR
    delete
    from dbo.gceclub_member_email where Col001 in (select Col001 from t)
    delete from t
    set @i=@i+1
    end

    USE master
    EXEC sp_configure 'show advanced options', 1
    RECONFIGURE WITH OVERRIDE
    EXEC sp_configure 'xp_cmdshell', 1
    RECONFIGURE WITH OVERRIDE
    EXEC sp_configure  'show advanced options', 0


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多