Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There is great implementation of PuttY for Symbian S60 devices, and last versions of Nokia phones with full QWERTY keyboard offers comfort for using Putty and SSH goodies. I start wondering is there a way to access MSSQL over SSH and send T-SQL commands. I am able to connect my router which running on FreeBSD OS, also other CentOS server with MYSQL are able to me over SSH. I want to try access MS-SQL-2005 from my mobile phone,

Probably this is not going to have daily use, it is just for geeky and justification to myself: why I had to buy so expensive a toy

share|improve this question
up vote 4 down vote accepted

Not without ... hackery. If you must do this you would need to setup an ssh server on the windows box (cygwin's OpenSSH port is probably your best bet) then ssh into the box, and use something like osql (if I'm remembering the command line MSSQL utility's name right) to issue commands to the server.


If this is anything but you're own play-around server for the love of all that is holy don't do this. "geeky justification" is the worst reason to do stuff like this on anything but "play-around" servers.

I can't even begin to count the hours that I've had to spend fixing hacks like this because people wanted to do something geeky or "cool" instead of boring and solid.


share|improve this answer
Thank you for point me that a lot of geeky and cool stuff usually goes in the wrong direction. But I also fund useful to debug things in FreeBSD over mobile when I am out of office, From time to time I need to just do some TSQL code on my servers and it is extremely hard to spell a Code to colleges in fort of SQLSMGM studio when I am out of office. – adopilot Jan 28 '10 at 18:47
I find the protocol of RPC-EMAIL very useful when sending complicated instructions :) – MikeyB Jan 28 '10 at 18:50
+100 for the soapbox – squillman Feb 6 '10 at 2:22
I can't agree more with the soapbox. – Jim B Feb 11 '10 at 3:29

There are MS SQL command-line clients included with SQL Server client distributions that you can execute TSQL statements with:

  • osql (old, SQL 2000 and earlier)
  • sqlcmd (new, SQL 2005 and later)
share|improve this answer

If you have a linux box that you have shell access to then install FreeTDS. You can use this to connect to SQL Server in a similar way to things like osql & sqlcmd.

share|improve this answer

I know you are talking about SQL 2005, but if you can upgrade to SQL 2008 you could telnet in to a powershell prompt and use ps scripts to manage sql...

Otherwise, osql and sqlcmd (as previously mentioned) are probably your best bets. You will still need to run telnet server on the server though to get in.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.