[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Running a large sql query

Posted on 2005-04-18
5
Medium Priority
?
263 Views
Last Modified: 2010-03-19
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
0
Comment
Question by:joekus
5 Comments
 
LVL 21

Accepted Solution

by:
Kevin3NF earned 2000 total points
ID: 13810172
You could put it into a stored procedure and call that procedure from the job step.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13810173
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
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 13810178
You can use osql to run it.
0
 
LVL 70

Expert Comment

by:Scott Pletcher
ID: 13810185
Note that isql is a much older utility; for new uses, you should always use osql.
0
 

Author Comment

by:joekus
ID: 13810381
Thanks for quick responses.  
Liked the idea of stored procedure as one less place usrname and pwd is floating about.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question