将多个 SQL 文件合并为一个 SQL 文件 [英] Merge multiple SQL files into a single SQL file

查看:66
本文介绍了将多个 SQL 文件合并为一个 SQL 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将多个 SQL 文件合并为一个 SQL 文件.我在互联网上所能找到的只是创建一个批处理文件并执行所有文件.但是,我想创建一个脚本文件.任何帮助将不胜感激?

I want to merge multiple SQL files into a single SQL file. All I could find over the internet is to create a batch file and execute all the files. However, I want to create a single script file. Any help would be appreciated?

另外,这可以用 C# 来完成吗?

Also, can this be done using C#?

推荐答案

假设您的文件在一个地方/文件夹中

assuming your files are in one place/folder

你可以在windows的命令行中这样使用,

you can use like this from the command line in windows,

cd c:\文件夹

for %F in (*.sql) do ( type %F >> final.sql )

for %F in (*.sql) do ( type %F >> final.sql )

注意:>> 用于追加到现有文件中,其中 > 每次都会覆盖该文件

Note: >> is used for appending to an existing file, wherein > will overwrite the file everytime

这篇关于将多个 SQL 文件合并为一个 SQL 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆