3 Replies - 532 Views - Last Post: 14 November 2008 - 06:45 AM Rate Topic: -----

#1 jibber4568  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 51
  • Joined: 11-February 08

Running Queries from desktop

Posted 13 November 2008 - 03:10 AM

Am using SQL Server. There is a query that I am having to run on a regular basis. Is there any way that I can run this query from the desktop with the results then exported to a text file, or something similar.
Is This A Good Question/Topic? 0
  • +

Replies To: Running Queries from desktop

#2 xerxes333  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 504
  • Joined: 05-July 07

Re: Running Queries from desktop

Posted 13 November 2008 - 06:35 AM

Are you using MS SQL Server Management Studio to run the sql? If so, there is a "Results to File" button on the "SQL Editor" toolbar.
Was This Post Helpful? 0
  • +
  • -

#3 jibber4568  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 51
  • Joined: 11-February 08

Re: Running Queries from desktop

Posted 14 November 2008 - 04:37 AM

Thanks for that. Do you know if there is anyway of storing a query that can be run from the desktop.

An icon that would run the query in Management Studio so I can then export to a file would work nicely.

Cheers
Was This Post Helpful? 0
  • +
  • -

#4 xerxes333  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 504
  • Joined: 05-July 07

Re: Running Queries from desktop

Posted 14 November 2008 - 06:45 AM

You can save the query as a .sql file and save it on the desktop, but if you double click the file it will open MS Management Studio (assuming that's what app you have assigned to open .sql files) and you will still have to execute the sql. I'm pretty sure you can use a batch file to connect and run the sql file but I'm not sure how you would get the results to a file. Start here (http://www.databasejournal.com/features/mssql/article.php/3566401/Using-SQL-Server-2005-sqlcmd-Utility.htm) and see how you progress.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1