January 26, 2006 at 3:28 pm
I have created a script to run against our sql database and output a report to a text file. This is something I am trying to automate for daily use. The script is longer than the 3200 charecters allowed in an SQL job in enterprise manager. I have created a batch file and scheduled it to run in the windows scheduler. This worked fine. However I have one problem. The output file has a bunch of garbage charecters at the top.
Ex of .bat file
isql /U xxx /d testrpt/P test/S %1 /i c:\scripts\testNumbers.sql /o c:\SCRIPTS\testNumbers.log
EX. of garbage on top of output file highlighted in red
1> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> 24> 25> 26> 27> 28> 29> 30> 31> 32> 33> 34> 35> 36> 37> 38> 39> 40> 41> 42> 43> 44> 45> 46> 47> 48> 49> 50> 51> 52> 53> 54> 55> 56> 57>
Report ID
Test
Run Date:
01/26/2006
Item Posting Date:
01/25/2006
Report text......
Is there a way to run my script and get rid of these charecters?
January 26, 2006 at 3:46 pm
Hello Dave,
Can you modify your .bat file according to the "isql" syntax and then execute the same?
Thanks and have a nice day!!!
Lucky
January 26, 2006 at 3:51 pm
Lucky,
Thanks for the reply! I have to admit I am not sure what you mean. Can you explain what you mean in more detail?
January 26, 2006 at 3:53 pm
Check in Books Online for the syntax of "isql". According to it, modify your .bat file contents and execute the same.
Lucky
January 27, 2006 at 1:30 am
What Lucky is trying to tell you is check the syntax for isql in BOL, look at the expanded arguments descriptions, and there is one that fixes your issue.
It's just another parameter to pass to isql - it's not -h and it's not -p, but it is somewhere in between.
Look for the one that says "Removes numbering and the prompt symbol (>) from input lines."
January 27, 2006 at 7:08 am
isql /U xxx /d test /P password /S %1 /n /i c:\scripts\testNumbers.sql /o c:\SCRIPTS\testNumbers.log
Lucky/Grasshopper,
I found it! Such an easy fix, yet not so obvious to me apparently. Thank you both for your help in finding this little gem. /n
The output now looks perfect
Thanks again
Dave
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply