本文介绍了BCP将所有文件从文件夹导入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
BCP导入
如何使用文件夹中的所有文件进行BCP导入.
How to do BCP import with all files in a folder.
文件夹
folder
- file1.csv
- file2.csv
需要导入两个文件.
bcp <tableName> in <filename> -t "^" -r "\n" -c -C 28591 -S <databaseinstance> -U <username> -P <password>
使用上述BCP cmd,我们一次只能导入一个文件.
Using the above BCP cmd, we can import only one file at a time.
推荐答案
简单的BCP命令仅导入单个文件.为了达到上述目的,我们需要在命令中使用循环.
simple BCP command import only single file.To achieve the above we need to use looping with the command.
我已经使用以下命令简单命令.
I have used the following command simple command.
for /r %i in (*) do bcp <tablename> in %i -t "^" -r "\n" -c -C 28591 -S <databaseinstance> -U <username> -P <password>
有效.
这篇关于BCP将所有文件从文件夹导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!