--开启xp_cmdshell sp_configure ‘show advanced options’, ; GO RECONFIGURE; GO sp_configure ‘xp_cmdshell’, ; --Switch on specific functionality GO RECONFIGURE; GO --Tab作为行分隔符,\n作为断行符 导出到H盘 EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT TOP 20 PERCENT * FROM…
SET @FilePath='D:\TEST.xls' SET @sql='bcp "SELECT * FROM XXX.dbo.XXX WITH(NOLOCK) WHERE XXX=''XXX'' AND XXX = '+@XXX+'" QueryOut '+@FilePath+' -c -T ' EXEC master..xp_cmdshell @SQL…
1.循环删除数据 while @@rowcount>0 begin delete top (1000) from T where OperateTime >=20140807 end 清除表数据 truncate table score 2.循环更新数据 方案1: while(1>0) begin update top(10000) tablename set col1=B.col1 from tablename A with(nolock) left…
DOS 选择跳转实现.dos + bcp 双击导入和导出数据 option.bat @echo off :Start2 cls goto Start :Start title Frequently Used Websites echo Please select a website from the list echo with the corresponding key echo -------------------------------------- echo [1] Google ec…