Tapatalk

Tool config for ISQL and selected text

Tool config for ISQL and selected text

2
NewbieNewbie
2

    Jun 30, 2006#1

    I've had a tool configured for a long time that passes the selected text to SQL Server's ISQL app and returns the results of the query to UE.

    Like so-

    Code: Select all

    "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\isql.exe" -Q"%sel%" -U username -P password -S servername -d dbname -w 1000
    I have a text file that contains a bunch of queries (each on a separate line, some are pretty long) that I need to run periodically. What I used to be able to do is simply shift+arrow down (with cursor in the home position) to select the line and then ctrl+shift+1 to execute the tool. This would work great and allowed me to step through my text file of queries one at a time, rather quickly.

    Since about v10 or v11 of UE, something has changed (and it might not be UE necessarily). The tool still works, but my method of selecting lines seems to add a CR to the %sel% now, and the execution of the tool now fails.

    I can select the line using shift+end and the tool works correctly. However, since some of the queries that I have can be quite long, it results in lots of horizontal scrolling in UE. It is really just a nag, but it does sometimes cause me to lose my place in the text file.

    Just wondering what has changed or if there is a setting somewhere that I am missing.

    Thx

      Jun 30, 2006#2

      Never mind... it never fails. The process of writing out this post got me thinking about the order of the parameters in the ISQL command line. By moving the -Q"%sel%" parameter to the end of the tool's command line, I avoid the CR messing up the execution of ISQL.

      Of course, this revalation occurs mere seconds after hitting submit. :)

      Oh well, maybe this will help someone else out.

      3
      NewbieNewbie
      3

        Feb 12, 2010#3

        UE version 15.20

        I am having this same problem w/osql.

        The query will not execute when it is more than a single line.

        When I highlight

        SELECT columns
        FROM table

        I get

        Msg 263, Level 16, State 1, Server Name, Line 1
        Must specify table to select from.

        When the SELECT statement is on a single line, it executes just fine.

        I have the tool setup as:

        Command Line > osql.exe -S Server -d db -E -w1000 -Q"%sel%"
        Working Directory > C:\Program Files\Microsoft SQL Server\90\Tools\Binn
        Options > "DOS Program" is only item selected
        Output > Append to Existing, Capture Output, No Replace selected

        Also, when I run this tool with the query on a single line, it ALWAYS creates a new Command Output file with the results. It never "Appends to Existing". Or am I misunderstanding what "Append to Existing" means?

        Any help will be sincerely appreciated, as I am anxious to move my sql work environment to UE.

        Thanx,

        Keith

        6,685587
        Grand MasterGrand Master
        6,685587

          Feb 12, 2010#4

          First it is not possible to pass multiline strings as parameter string via command line to a console application. DOS/Windows does not allow it. The command interpreter of Windows always interprets a line termination as end of command line and executes the command with the string to the line termination character. Also the length of the command line string is limited by Windows. If you want to pass a multiline selection to a tool, you have to save the selection into a file and call the tool with the file as input using the appropriate parameter of the tool for this type of input.

          Second I tested with UE v15.20.0.1026 the tool configuration setting Append to Existing with calling just the DIR command as tool and it worked fine. Your tool settings are correct. Is it possible that the Alternate Capture Method is enabled. This command existed in the menu Advanced in older versions of UltraEdit, but is not available anymore by default in any menu. So you have to open %appdata%\IDMComp\UltraEdit\uedit32.ini best with Notepad while UltraEdit is not running and search for Alternate Capture=. If you can find this setting in section [Tools] and it has the value 1, change the value to 0, save the INI file of UltraEdit, start UE and try again if appending the captured output to existing file now works.
          Best regards from an UC/UE/UES for Windows user from Austria

          3
          NewbieNewbie
          3

            Feb 12, 2010#5

            Thanx for the info on the DOS command line.

            I'll see if I can figure out how to get this moved over into a saved file and passed to osql.

            I've been on UE for quite some time, but my machine recently got wiped out, so I did a fresh load, probably on version 12 or 13.

            I did a search for uedit32.ini and found nothing.

            I'll see if I can get the tool working with a file and if the problem persists.

            Thanx much for your help.

            Keith

            6,685587
            Grand MasterGrand Master
            6,685587

              Feb 12, 2010#6

              Please start Notepad, press Ctrl+O to open the file open dialog and paste %appdata%\IDMComp\UltraEdit\uedit32.ini into it to open that file. Or copy just %appdata%\IDMComp\UltraEdit into the address bar of Windows Explorer and hit key RETURN to open this folder and you will suddenly see what you could not find before. Reason?

              %appdata% references the environment variable APPDATA which contains the path to the OS dependent, language dependent and user account dependent application data directory. The application data directory has by default the hidden attribute set and by default hidden files and folders are not found by the Windows search and are not displayed in the Windows Explorer.

              You can see the entire file name of the INI file used by UltraEdit in UltraEdit at Advanced - Configuration - Application Layout - Advanced. But with the Windows default settings you will not be able to browse to this folder with Windows Explorer. Why? Microsoft wants to prevent non experts in computer usage deleting or modifying by mistake files and folders where the applications save their configuration settings related to the users configuration.
              Best regards from an UC/UE/UES for Windows user from Austria

              3
              NewbieNewbie
              3

                Feb 12, 2010#7

                Excellent! I found the folder, but find no 'Alternate Capture' defined under Tools or anywhere else in the file.

                I do have Capture ModeX where X = 0 to 24.

                Also have CaptureX where X = 0 to 24.

                All are set to 0 except Capture2 - Capture24, which are set to 1.

                I found an example of the batch file that I need to create and am working on that now.

                Thanx for all your help and your explanations of why things are the way they are. It actually makes this a learning experience of value.

                Keith