Running a large sql query

I have a large *.sql file that I run regularly in Query analyzer.  I tried setting up a job in Management>>Sql Server Agent.  The max allowed in each step is 3200 characters.  My file is over 7800 characters.  Is there anyway to run this on a schedule without having to break this working query up?

Thanks,

JK
joekusAsked:
Who is Participating?
 
Kevin3NFConnect With a Mentor Commented:
You could put it into a stored procedure and call that procedure from the job step.
0
 
rafranciscoCommented:
You can execute the sql script using the following:

EXECUTE master.dbo.xp_cmdshell 'isql -S <ServerName> -U <UserName> -P <Password> -d <DatabaseName> -i "YourFileNameHere"'
0
 
Scott PletcherSenior DBACommented:
You can use osql to run it.
0
 
Scott PletcherSenior DBACommented:
Note that isql is a much older utility; for new uses, you should always use osql.
0
 
joekusAuthor Commented:
Thanks for quick responses.  
Liked the idea of stored procedure as one less place usrname and pwd is floating about.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.