Question

I'm trying to completely automate my builds and part of it is applying SQL scripts to the SQL Server.
I've created a batch file that calls SQL Server utility (OSQL.EXE) to apply scripts and it works if I call it directly on the SQL server.
But I cannot use it on my build machine because it does not have SQL Server installed.

Is there way to start my batch on the remote machine from my build machine?
Is there another solution to this problem?

Was it helpful?

Solution

install just Sql Server Client

  • Microsoft SQL Server 2005 Management Objects Collection: and then you can use that to run any scripts or anything else from C#. so you could create a project that does the stuff with SMO and use it in your build setup.

  • Microsoft SQL Server 2005 Command Line Query Utility: installs just SQLCMD and do stuff with that.

OTHER TIPS

You could install SQLExpress on your client machine for free and use sqlcmd.exe, which is an equivalent of osql and isql tools on MSSQLServer.

To use osql, you need SQL Server installed, but you could use another data access method to communicate from the remote machine to the SQL Server machine. For example, you could have a .VBS script use ADO.

Two ideas:

  1. Have you tried copying OSQL.exe and installing the client SQL Server libraries on your build machine? I haven't but I think it's worth a try.

  2. Write a program that connects and feeds the data, shouldn't be too hard. Reads the SQL from a file and feeds it to the specified SQL Server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top