Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a SQLCMD equivalent on *nix?

Tags:

unix

sqlcmd

We have a heterogeneous environment where some developers are using OSX and some are using Windows. Our build process involves DB revision control and needs to call SQLCMD to execute arbitrary scripts - our databases are all SQL Server.

SQLCMD is the command line interface to SQL Server on Windows, similar to Oracle's SQL*Plus. The particular functionality we need is the ability to run SQL scripts from the command line. Is there a SQLCMD equivalent for *nix?

If there isn't then the only cross-platform approach I can think of would be to load a script file into memory, then execute the script.

Is there a clear leader for a library/language combination that will handle all T-SQL DDL statements? (I ask about DDL statements because they have been the hangup on this approach when I've tried it in the past.)

like image 752
Josh Kodroff Avatar asked Nov 28 '25 06:11

Josh Kodroff


1 Answers

You might try the fisql utility, which is part of FreeTDS, an open-source implementation of the SQL Server wire protocol. fisql is purported to be a clone of the ancient isql, predecessor of osql, predecessor of sqlcmd, but presumably it will work with any level of T-SQL.

Disclaimer: I haven't used FreeTDS myself.

like image 101
Michael Ratanapintha Avatar answered Nov 29 '25 22:11

Michael Ratanapintha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!