I have found out how to run and execute a LINQPad query from the command line by using the following command
LINQPad.exe "path to the script.linq" -run
This will launch LINQPad, run the script but it leaves LINQPad open. Is there anyway that I can get LINQPad to close after execution?
Many thanks
Jonathan
This is not supported at present, but full command-line functionality should be available within a month or so via a new lprun.exe tool that will ship with LINQPad. The tool will be free, and will support text, JSON and HTML output.
Edit: This is now available: http://www.linqpad.net/lprun.aspx
Related
For only one particular SSIS package (v. 2005) I am getting the following error when trying to open the script task...
TITLE: Microsoft Visual Studio
Cannot show the editor for this task.
ADDITIONAL INFORMATION:
The operation could not be completed. (Microsoft.VisualBasic.Vsa.DT)
BUTTONS:
OK
I need to get into this to be able to edit it, also I am in the process of upgrading it to 2014. Once upgraded I can get in, but there is no code, so assume the upgrade is not working as it=self cannot see the code within.
I have tried other machines - same problem.
I have tried other packages - they work fine - even in the same solution.
I have tried a few resets found on the net/re-installs - same problem.
Clearly its something to do with this specific package only, but I am stumped.
I would expect to be able to open the Script task like any other, and be able to edit it. I would also expect the upgrade to work and contain the code.
If you want to read the Script Task code, open the package file (.dtsx) using a text editor (Notepad++), and search for the Script Task code, copy the Script Task code and recreate the script and paste the code within the Script editor.
If you have a problem with Script Tasks in visual studio 2005, then copy the code to an external file, upgrade the package to 2014 then paste the code inside the Script Task (since it will be empty after upgrade)
I'm using Gradle for build automation. Part of my automation process is to run tSQLt unit tests on SQL Azure databases. I use SQL Groovy through a JDBC driver. A failed test will be reported back to Gradle correctly, but doesn't give any information other than how man tests failed. The tSQLt framework provides a great summary, but uses PRINT to display it in SSMS.
I would really like to redirect the PRINT summary from tSQLt (basically a PRINT command in SQL Server) to a file, or even the screen. Just so it doesn't get lost.
I may not be using the correct connection method, but to run the unit tests and have them report errors back, I use:
sqlConnection.executeUpdate("exec tSQLt.runall")
There's probably a better method that will allow me to pipe the output, but I haven't been able to find it.
I am a sublime text lover but at my job I am forced to use Microsoft Visual Studio along with Microsoft SQL Server. I want to possibly just use sublime since I'm quite familiar with it and my workflow is just so much better. To do so I would need to know how to run the SQL queries in sublime text? I have been doing some research and found a couple builds but none that work so I'm wondering if it's even possible if so how?
It's difficult to create complex IDE from ST2 due it's ascetic UI API.
Even OracleSQL package doesn't give the power of PL/SQL Developer or Toad for Oracle.
So, maybe it's better to join SQLMS with ST. For example write in ST, but run, debug and edit in SQLMS.
Here is my setup for using ST and SQLMS together.
Set up ST to auto re-read file changes if file saved
Set up SQLMS to auto re-read file changes if file saved
Set up External Tool - "Open in Sublime Text" in SQLMS and bind it to ctrl+o,ctrl+s
command: C:\Portable\Sublime Text 2\sublime_text.exe
args: $(ItemPath):$(CurLine):$(CurCol)
dir: $(ItemDir)
Install improved "SQL Ex.tmLanguage" syntax highlight from here
After setup you can open same file in ST and SQLMS and switch between editors easily.
Late to this but was just trying to do the same thing.
A very crude solution I just tested in ST3 uses the following (you need to create a new Build system in ST and then associate it with your SQL file)
{
"cmd": ["sqlcmd", "-E", "-i", "$file"]
}
It uses a trusted connection to SQL and assumes the sql script will either run as-is in the default database, contains a "USE" statement or table names are otherwise fully qualified.
For additional tweaking, run sqlcmd /? from a command prompt or read more here
TSQL Easy is a package you can download which has some tools to run TSQL and SQL scripts. It also has good TSQL syntax highlighting in sublime text 2. Actually it's the only TSQL syntax highlighting I've found so far.
You can get the package here (or through package control): https://github.com/tosher/TSQLEasy
We've used a Visual Studio database project to manage our database schema. What we would like to is include .sql output of a database deployment as part of our products installer which is being created in InstallShield.
However when we add the sql script to the InstallShield project and run the installer, the installer fails to run the script. We get an OLEDB error complaining about the :setvar(s), although I could edit the sql script manually and fix it this isn't really a long term solution.
Garbage In Garbage Out. InstallShield just reads the scripts and executes it against an OLEDB connection. You can tell it On Error Abort, On Error Goto Next Statement or On Error Goto Next Script. Other then that it is what it is. If your SQL has problems they need to be fixed.
InstallShield can do search and replace processing on your SQL. Without a sample of your SQL it's difficult to say exactly what to do but take a look at:
Using InstallScript Text Substitution to Dynamically Replace Strings in SQL Scripts
I've a list of .sql script files to create Stored Procedures which I'm using the Eclipse DTP to develop. Currently to create/update all these Stored Procedures, I've to open & run
one by one from the Data Perspective.
Is there a way to create a batch file that run the scripts along the lines of
run createSP1.sql
run createSP2.sql
...
run createSPn.sql
and run it in the Eclipse DTP to avail of the DB connection defined there?
why not just create a batch file that merges all of your .sql files together into a single procs.sql file as part of the build process. I don't know what platform you're running on but in Windows you could have a .bat file that does something like this:
type *.sql > proc.sql
then to apply it to the database, why not do it outside Eclipse and connect to the database via the command line. You could bundle this all up as a single batch file that gets the latest version of your stored procedures from source control, merges them into a single file and then applies it to the database.
Part I
As far as I know the developers of Eclipse DTP
have not yet implemented a command line SQL execution
interface through the Eclipse console view.
See the following URL on the eclipse DTP developer forum
http://dev.eclipse.org/newslists/news.eclipse.dtp/msg00304.html
Part II
While the Eclipse DTP people are working on it,
you can use a database specific tool to load
a master SQL file (all SQL proc files
appended together)
There are database specific console
tools that will load your master SQL file
command line.
(ie. SQL*Plus for Oracle, ij for Apache Derby)
Part III
An improvement over DOS batch is using Cygwin bash
or python or perl to merge all of your sql files
together into a master file.
I found that the text processing tools available
in UNIX (awk,sed,cat...) are great for this sort
of thing.