Link to home
Start Free TrialLog in
Avatar of joekus
joekus

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Kevin Hill
Kevin Hill
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rafrancisco
rafrancisco

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"'
Avatar of Scott Pletcher
You can use osql to run it.
Note that isql is a much older utility; for new uses, you should always use osql.
Avatar of joekus

ASKER

Thanks for quick responses.  
Liked the idea of stored procedure as one less place usrname and pwd is floating about.