zoukankan      html  css  js  c++  java
  • Excel数据汇出

    1.EXEC master..xp_cmdshell 'bcp DataTest.dbo.AirPerformance out D:\WinForm\ProjExcel\Files\Engg_Index_DFS\Report\airperformancetol.xls -c -q -S "WUSF\DAT" -U"sa" -P"055122"'

    2.EXEC master..xp_cmdshell 'bcp "select * from DataTest.dbo.AirPerformance" queryout D:\WinForm\ProjExcel\Files\Engg_Index_DFS\Report\airperformancetol.xls -c -q -S "WUSF\DAT" -U"sa" -P"055122"'

    如果加字段,配合union all

    3.declare @sql varchar(8000),@path varchar(8000),@tbname varchar(8000)
    set @path='c:\a.xls'
    set @tbname='sheet1'
    set @sql='openrowset(''MICROSOFT.JET.OLEDB.4.0'',''Excel 8.0;HDR=YES
    ;DATABASE='+@path+''',['+@tbname+'$])'
    exec('insert into '+@sql+'(f1) select Reportno from AirPerformance ')
  • 相关阅读:
    bzoj1027
    bzoj1069
    poj2079
    poj2187
    bzoj2281
    bzoj2285
    bzoj1558
    bzoj1822
    bzoj1559
    bzoj1570
  • 原文地址:https://www.cnblogs.com/cnaspnet/p/443290.html
Copyright © 2011-2022 走看看