怎样将某个目录里面的txt文件转换成sqlserver的数据库?用DTS每次只能选一个txt文件 用exec master..xp_cmdshell 'copy 你的目录\b*.txt 你的目录\ALLB.txt'上面的语句做成一个DTS的SQL任务,把它设为第一位运行.这样再用DTS导不就可以一次导多个文件了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @n intdeclare @sql varchar(8000)set @n=30304while (@n<30400)( @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -S服务器名 -U用户名 -P密码''' exec(@sql)) 更正:declare @n intdeclare @sql varchar(8000)set @n=30304while (@n<30400)( @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -S服务器名 -U用户名 -P密码''' exec(@sql) set @n=@n+1) 用copy合并文件,文件联接处的格式可能会有改变 要注意一下 不好意思,^_^再补充:declare @n intdeclare @sql varchar(8000)set @n=30304while (@n<30400)( @sql = 'master..xp_cmdshell ''bcp 库名..表名 out 路径\b200'+@n+'.txt -c -t | -r \n -S服务器名 -U用户名 -P密码''' exec(@sql)) 请问上面的是什么语言,能嵌入delphi程序中吗? T-sql语言,做成个存储过程在delphi调用吧 不行啊,在生成存储过程中写入以上代码,检查语法时候说“在+号附近有错误阿”,想必是因为@n的问题,去掉后就通过了。怎样改变阿?把@n改为varchar类型也试过了,都不行。 存储过程的问题 急... 求一简单SQL语句 sql 数据库 怎样写一个关于在线查询电脑配件的系统的需求分析啊? 求一个SQL的排序方法!! 怎样得到结果正确唯一? 求一SQL语句,不想自已动脑筋了(用一句来实现,用存储过程或任何其他中间环节的不要) 关于数据库的关系表占用空间问题 请教一条sql语句????? ### icevi(按钮工厂)、KingSunSha(弱水三千)请进来,问题:如何有效保护MDB数据库 # 请教:怎样将几个字符变量组合成一个时间变量? 怎样将某个目录里面的txt文件转换成sqlserver的数据库?用DTS每次只能选一个txt文件
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)
)
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
)
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)
)