sql server 2005 批量导入导出
declare @CMD_STR varchar(100) declare @i intdeclare @memo nvarchar(50)set @memo='数据分离'set @i=0while @i<=153begin
insert into t select top 15000 * from dbo.gceclub_member_email
select @CMD_STR= 'bcp jive.dbo.t' + ' out C:TDDOWNLOADtest' + @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 tset @i=@i+1end
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