如何将sql文件转换为可执行文件 [英] How to convert sql file to executable file

查看:275
本文介绍了如何将sql文件转换为可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



请帮我解决这个问题。



有没有将多个.sql文件转换为.exe /可执行文件的方法。



在我们的应用程序中,我们使用了400多个表和超过500个sp。在释放时间的同时,目前我们给每个sp / table / view / etc都是单独的文件(.sql文件),所以文件的计数非常高。



在客户端,客户端将打开每个文件并执行。它是一个非常繁重的任务,所以有什么方法可以将.sql文件转换为可执行文件?

解决方案

可能你可以尝试使用SQLPACKAGE.exe并创建批处理文件(.bat)并将它们作为可执行文件运行


您无法将sql脚本转换为可执行文件。这显然是胡说八道。

尽管如此,你的要求本身也是有道理的。

首先,你可以连接脚本,这样就可以得到一个。

您还可以使用 sqlcmd实用程序 [ ^ ]执行脚本。因此,您可以简单地创建批处理或vbs脚本,该脚本扫描文件夹以查找具有sql扩展名的文件,并逐个执行它们。或者你甚至可以使用powershell。



当然,您可以将sql文件转换为资源,并将它们嵌入到将针对sql server和数据库执行它们 [ ^ ]。但你必须考虑是否真的需要这个。具体取决于有经验的用户最终会如何使用它。如果客户端可以逐个执行脚本,那么简单的批处理脚本也将是一个巨大的飞跃,但对于没有任何SYSDBA经验的用户,我会生成这个可执行文件。但同样:它不是转换。你需要为自己的目的制作一个。




你的陈述我能理解你可以通过以下方式实现你的目标...

你可以为它生成脚本。



1)只需右键单击你的数据库。

2)go任务

3)选择生成脚本

4)按照屏幕上给出的说明按照步骤操作。

然后你去..



详情请浏览以下链接..





http://blog.sqlauthority.com/2011/05/07 / SQL服务器-2008-2008-R2创建脚本到复制数据库架构和所有的对象,数据架构的存储过程,函数,触发器,表,视图,约束和-all-其他-d atabase对象/ [^]

Hi all,

Please help me out to solve this issue.

Is there any way to convert more than one .sql file to .exe/Executable file .

In our application, we are using more than 400 tables and more than 500 sp's. while releasing time, currently we are giving each sp / table / view / etc are separate file(.sql file) so count of the file is very high.

In client side, client will open each file and execute. its a very heavy task so there is any way to convert the .sql file to executable file?

解决方案

May be you could try using SQLPACKAGE.exe and create batch files (.bat) and run them as executable


You can not convert an sql script to executable. This is clear nonsense.
Still, your requirement itself makes sense.
First of all, you can concatenate the scripts, thus you can get a single one.
You can also use sqlcmd utility[^] to execute the scripts. So you can simply create a batch or vbs script that scans a folder for files with sql extension for example and executes them one by one. Or you can use even powershell for that.

Of course, you could convert your sql files to resources, and embed them into an executable that is will execute them against the sql server and the database[^]. But you have to consider if you really need this. It depends on how experienced users will use this at the end for example. If the client could live with executing scripts one by one, a simple batch script would be also a huge leap, but for users without any SYSDBA experience I would make this executable. But again: it is not a "conversion". You need to make one for your own purposes.


Hi,
what ever i understood by your statement you can achieve your goal in following way...
you can generated script for that.

1) just Right click on your database.
2)go to task
3) select "Generate Scripts"
4) follow the steps as per instructions given on the screen.
and there you go..

for details go through the below link..


http://blog.sqlauthority.com/2011/05/07/sql-server-2008-2008-r2-create-script-to-copy-database-schema-and-all-the-objects-data-schema-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/[^]


这篇关于如何将sql文件转换为可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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