用exec master..xp_cmdshell 'copy 你的目录\b*.txt 你的目录\ALLB.txt'
上面的语句做成一个DTS的SQL任务,把它设为第一位运行.这样再用DTS导不就可以一次导多个文件了.

解决方案 »

  1.   

    declare @n int
    declare @sql varchar(8000)
    set @n=30304
    while (@n<30400)
    (
       @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -S服务器名 -U用户名 -P密码'''
       exec(@sql)
    )
      

  2.   

    更正:
    declare @n int
    declare @sql varchar(8000)
    set @n=30304
    while (@n<30400)
    (
       @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -S服务器名 -U用户名 -P密码'''
       exec(@sql)
      set @n=@n+1
    )
      

  3.   

    用copy合并文件,文件联接处的格式可能会有改变 要注意一下
      

  4.   

    不好意思,^_^再补充:
    declare @n int
    declare @sql varchar(8000)
    set @n=30304
    while (@n<30400)
    (
       @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -t | -r \n -S服务器名 -U用户名 -P密码'''
       exec(@sql)
    )
      

  5.   

    请问上面的是什么语言,能嵌入delphi程序中吗?
      

  6.   

    T-sql语言,做成个存储过程在delphi调用吧
      

  7.   

    不行啊,在生成存储过程中写入以上代码,检查语法时候说“在+号附近有错误阿”,想必是因为@n的问题,去掉后就通过了。怎样改变阿?把@n改为varchar类型也试过了,都不行。