executing query from cmd

Hello,

I want to connect to tode which is in RDP (remote desktop), from my local machine through cmd. and run the tode sql query.

please help me on this. i am not getting how to do it. Thank You in advance.

It is working with ms Sql Server, but not with Toad

I am able to do this with ms sql server. and it is working fine.

heir what i do to run mssqlserver query from cmd in rdp

Step1- cmdkey /generic:“serverIP” /user:“myUsername” /pass:“myPassword”

Note: step 1 will save all the credentials of my remote desktop .

Step2 - sqlcmd -S serverIP -d myDatabasename -UmyUsername -Pmypassword -Q “SELECT * from dbo.dbname” -o Desktop\filename.txt

Note: step 2 will execute the query and store the output in txt file in my desktop

I want to do same thing with Toad for sql server. but not getting what to do. Please help.

Hi saurabh_mosesram,

I don’t know if this is possible to do this via TOAD SS on your local machine.

Probably someone of the DEll’s team (Cathy or Kelly) can explain or help to you in more details.

I think this is more useful use TOAD in Remote Desktop Protocol on your remote machine or server.

If you can use RDP to connect to yout remote machine, you can install TOAD SS on this remote machine and after connect to your SQL Server DB and administer it.

If your DB is big is not simple execute SQL query on remote DB with more records.

This is only my opinion. I don’t know your situation and probably isn’t the best solution…

What’s do you think of this ?

Best regards,

Sergio

Hi,

Sorry, Toad For SQL Server do not support using cmd line to execute query,

Would you like to add an enhancement for this? I can do for you.

Thanks,

Cathy.

Hello Cathy,

Thankyou for this information, with this enhancement are we able to run query from cmd?. If yes, i would like to an enhancement. Please let me know what need to be done. Thank you once again.

You can execute things in Toad using the command line and a small XML script file with the extension of TCS . However the output will still be in the UI of the target machine. We have no plans of turning Toad into a command line interpretter unfortunately.

You can also use automation to execute queries and execute the result to a text file relatively easily. The end result will be on the machine that runs Toad though.