Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schedule a query in SQL Server

Status
Not open for further replies.

tvbruwae

Programmer
Aug 9, 2001
224
EU
Hi

Can someone tell me how to turn an SQL script into a scheduled task? I wrote a query that is larger than 255 characters, so using TSQL for the task won't be possible. If there is a tool to transform an SQL file into a batch, could you tell me the name of this tool?

Thanks.

Tim
 
I know how to do this in MS SQL 7, but I can't find it in 6.5... There I can only choose to make the following tasks : CmdExec, Distribution, LogReader, Sync and TSQL. TSQL can only accept SQL queries up to 255 characters, and CmdExec can't execute SQL files. This has to be possible somehow?
 

Here are two possibilities.

1) Create a stored procedure from your SQL script. Use the TSQL in the Job to execute the stored procedure.

2) Store the SQL script in a file. Use ISQL to execute the script in the file. Execute ISQL using CmdExec in the Job. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top