开发者

Running a script on a target machine without having SQL server installed on that machine

开发者 https://www.devze.com 2023-01-19 12:19 出处:网络
I have a program that will run on several machines. I cannot control exactly which machines this program will be running on, but all will link to the same database that is located on a server somewher

I have a program that will run on several machines. I cannot control exactly which machines this program will be running on, but all will link to the same database that is located on a server somewhere.

The program might require to run a script that is recevied in the form of a .sql text file.

Currently, the program is starting osql with the proper parameters to run this script, and that works fine.

However, some machines running this program do not have MS SQL Server (or Express), so osql is not possible to run on that machine.

I can't control which machines will run this, or force the owner of those machines to install MS SQL Express, so I need one of the following:

  1. Find a replacement to osql that I can distribute alongside my program, and use to run the script.

  2. Use a builtin function inside C# to run the script from file. I have tried reading the file and running command by command开发者_如何学C on the SQL server but that is way to slow ( the script file might be really big in some cases)

Thanks in advance.


These pages suggests that SQLCMD - the replacement for osql/isql - is resdistrbutable, although you should look into the license terms in detail before you do so:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc

http://www.microsoft.com/downloads/en/details.aspx?FamilyId=228DE03F-3B5A-428A-923F-58A033D316E1&displaylang=en

Runnning a .sql file from C# has already been answered.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号