Overview of SQLDBX Welcome To SQLDBX: Features at A Glance
Overview of SQLDBX Welcome To SQLDBX: Features at A Glance
Features at a glance:
High performance native support for major Database Servers including Microsoft, Sybase, Oracle and IBM DB2/UDB Browse / Explore Servers Fast, intelligent, extensive and highly customizable Intellisense Advanced script Editor with Syntax highlighting, Auto Complete, Speed Typing, Drag/Drop, Undo/Redo, Find/Replace Unicode support Visual Data Diff SQL Scripting SQL Formatter / Beautifier Generate SELECT, INSERT, UPDATE, DELETE, WHERE IN data modification statements directly from result grid SQL templates with replaceable formal parameters Import / Export to CSV, XML, Excel Schema object browser SQL statement history Favorite objects Search in Database and in Result grid Directly edit table data in Result grid Display query plan and query statistics Simple deployment and removal. No dll's or other dependencies. Just one executable (1.4 meg.)
Set Alias button can be used to create alternate user friendly name for the Server. Also it is useful when you connect to the same server using different credentials. Use Alt. Background an Text color check box allows to specify alternate text and background colors. This allows to visually differentiate between production and development Servers. Set Alias button allows to create multiple aliases for the same Server. You can create it by directly typing into Server combo box. Make sure that actual Server name enclosed between "(" and ")" Using SqlDbx
SqlDbx portable
If you wish to use SqlDbx in portable mode create and empty SqlDbx.ini file in a same directory where SqlDbx.exe located. After you start SqlDbx it will run in portable mode. In this mode SqlDbx will not make any changes to registry or create directories / files on a computer.
Cursor Movement
Left Right Up Down Ctrl + Up Ctrl + Down Ctrl + Right Ctrl + Left End Ctrl + End Home Ctrl + Home Move cursor one character left Move cursor one character right Move cursor one line up Move cursor one line down Scroll screen up Scroll screen down Move cursor one word right Move cursor one word left Move to end of line Move to end of last line in file Move to beginning of line Move to beginning of file
Edit
Ctrl + Y Ctrl + Shift + Delete Delete current line Delete all
Ctrl + Delete Ctrl + Backspace Insert Ctrl + C Ctrl + V Ctrl + Shift + V Alt + Shift + V Ctrl + Alt + V Ctrl + X Ctrl + Z, Alt + Back Shift + Tab Ctrl + Shift + C Ctrl + Shift + R Ctrl + Shift + U Ctrl + Shift + L Ctrl + Shift + M Ctrl + Shift + Up Ctrl + Shift + Down
Delete to start of word to the right Delete to start of word to the left Switch between overwrite and insert mode Copy to Clipboard Paste from Clipboard formatted as SQL Paste from Clipboard Excel style Paste as column block Paste as column block (fill) Cut to Clipboard Undo Indent to the left Comment selection out Un comment selection Convert selection to upper case Convert selection to lower case Replace template parameters Move current line up Move current line down
Selection
Ctrl + A Alt + Left Mouse Button Alt + C Shift + Left Mouse Button Ctrl + B Ctrl + Shift + B Shift +Left Shift + Right Shift + Up Shift + Down Shift + Home Shift + End Shift + Page Down Shift + Page Up Ctrl + Shift + Home Ctrl + Shift + End Ctrl + Shift + Left Ctrl + Shift + Right Select all Start column (block) selection Set block selection on. Use Shift + Arrow keys to extend selection Extend selection to click point Select SQL block starting from current position Select current block delimited by empty lines Extend selection to the Left Extend selection to the right Extend selection one line up Extend selection one line down Extend selection to the beginning Extend selection to the end Extend selection one page down Extend selection one page up Extend selection from current position to the beginning of script Extend selection from current position to the end of script Extend selection to the beginning of current word Extend selection to the end of current word
Bookmarks
Ctrl + F2 F2 Shift + F2 Ctrl + Shift + F2 Toggle bookmark Go to next bookmark Go to previous bookmark Clear all bookmarks
Miscellaneous
Ctrl + E, F5 Ctrl + Enter Ctrl + T Ctrl + F Ctrl + Shift + Q Ctrl + Shfit + D F6 F3 Shift + F3 Ctrl + G Ctrl + J Ctrl + M Ctrl + H Ctrl + Page Down Ctrl + Page Up Ctrl + 1 Ctrl + 2 Ctrl + 3 F7 F8 F9 Execute SQL statement Execute SQL statement on current line Execute last SQL statement Show Find dialog Quick Diff Script Quick Diff Result Set Quick Find Find next Find previous Go To Line Format selected SQL Highlight all words like the one under the cursor Show Replace dialog Next Script window Previous Script window Switch focus between Editor and Results Switch focus between Editor and Object List Set focus to Script Editor List Tables List Procedures and Functions List System Functions
Ctrl + Right Ctrl + Left End Ctrl + End Home Ctrl + Home
Move right to the edge of data region* Move left to the edge of data region* Enables "End" mode Move to the last grid cell Move to the first column in current row Move to the first grid cell
Selection
Left Mouse Button in top left corner Shift + Left Mouse Button on Column Header Shift + Left Mouse Button in grid area Left Mouse Button on Row Header Ctrl + Left Mouse Button Shift + Left Shift + Right Shift + Home Shift + End Shift + Down Shift + Up Shift + Page Down Shift + Page Up Ctrl + Shift + Home Ctrl + Shift + End Ctrl + Shift + Left Ctrl + Shift + Right Ctrl + Shift + Up Ctrl + Shift + Down Select all Select all column Extend selection from active cell to clicked cell Select all row Begin new selection without clearing current selection Extend selection one cell left Extend selection one cell right Extend selection to the first grid cell Extend selection to the last grid cell Extend selection one cell down Extend selection one cell up Extend selection one page down Extend selection one page up Extend selection to the first grid cell Extend selection to the last grid cell Extend selection left to the edge of data region* Extend selection right to the edge of data region* Extend selection up to the edge of data region* Extend selection down to the edge of data region*
Clipboard
Ctrl + C Ctrl + Shift + C Ctrl + Alt + C Copy to Clipboard Copy to Clipboard with column headers Copy to Clipboard column headers only
Miscellaneous
Ctrl + Shift + N Ctrl + Shift + D Left mouse button double click on column header Ctrl + Left mouse button on column header Left mouse button on column header and drag New Result tab Close active Result tab Toggle column sort ascending / descending Add column sort Rearrange columns
* - data region: A range of cells that contains data and is bounded by empty cells
2.5 Intellisense
Using Intellisense
Intellisense is configured in Options dialog on Editor page. Intellisense and temporary tables in MS Sql Server and Sybase ASE. For intellisense to work with temporary they have to be created and then "referenced". Referenced means that you have to type something in Editor to cause the information about them loaded. For example if you created temporary table named #tmp then just type #tmp. and after that #tmp table will start to show up in Intellisense list window. If you drop and recreate temporary table with different definition you have to refresh objects in a left pane in order to reset Intellisense information for temporary tables.
Display objects from other Schemas (Oracle, DB2) or other Databases (Sybase MS) Enables or disable following options Displays and enables autocomplete for Keywords Displays and enables autocomplete for User Objects Displays and enables autocomplete for System objects Automatically capitalizes Procedures/Functions
Templates are files containing SQL scripts that help you use predefined code templates. Template files should be copied to a directory defined in Options->General->Templates. Files should be copied into one of the subdirectories of path specified in Options. Template files are ordinary text files containing SQL code. The template files can use formal parameters to help you customize the code. Template parameter definitions use following format: <parameter_name, data_type, value> where
parameter_name is the name of the parameter in the script. data_type is the data type of the parameter (optional). value is the value that is to replace every occurrence of the parameter in the script (optional).
Example: CREATE PROCEDURE <procedure_name> AS BEGIN END <procedure_name>; Use the Replace Template Parameters dialog box to insert values into the script. Note You can use the Replace Template Parameters dialog box to specify values any time a parameter definition is used in code. For example, when you script execute function from Object View, the function written to the current Script window will contains parameter definitions for any arguments in the function. You can, therefore, use the Replace Template Parameters dialog box to specify argument values. Also if you have text selected in Editor and invoke Replace template Parameters dialog then only selection will be checked for any template parameters It is possible to specify cursor position in template. Put symbol "^" anywhere in the template text.
To use a template
Open a Script window. If template manager window is not visible press Manage SQL Templates button on the toolbar. Navigate to desired template and select Insert Template menu item or double click left mouse button. When the template is displayed in the Script window, select Replace Template Parameters button on the toolbar. In the Replace Template Parameters dialog box, specify values for the parameters. To insert the specified values into the script in the Editor pane, click Replace.
1. Simple replacement. If Shortcut column contains sla and column Substitution Value contains SELECT * FROM then when you type sla in Script Editor and press space it will be replaced by SELECT * FROM 2. Use Speed typing to add Auto Complete strings. Simply enter desired string into Shortcut column and leave Substitution column blank 3. Using formal parameters: If Shortcut column contains sla (var_date, var_string) and Substitution column contains SELECT * FROM TABLE_NAME where date_col = '$(var_date)' and string_col = '$(var_string)' then when in Script Editor you type: sla (01/01/07, string_value) it will be expanded into: SELECT * FROM TABLE_NAME where date_col = '01/01/07' and string_col = 'string_value' To specify cursor position in Editor after speedword expansion put symbol '^' anywhere in text
Examples:
You can import previously exported data by selecting Import From->File menu item from table popup menu. If table name in the file different from selected table it will be automatically replaced. Also file can be opened as ordinary file in Script Editor.
Export to Excel
Select Export To->Excel menu item from table popup menu to copy all table data to Excel
You can import table data from Excel by first selecting range in Excel which contains table data with table column names in the first row. Order of columns is not important. Some column can be omitted too. To import data from Excel select table into which you want to import data. Right click and select Import From menu item. Select menu item with Excel session in which you previously selected data. Data from Excel will appear in a new Script Editor window as a series of INSERT statements. Now you can edit or execute script to insert data into the table.
2.12 Options
Options
Options Dialog is accessible from toolbar or Main Menu->Tools. General Options Editor Options Colors Results Options Scripting Options Import / Export Servers
Arguments
-t server_type -s server_name -d database_name -u user -p password -n -l -q script file -r -w workspace file -c Can be one of the following: microsoft, sybase, oracle, ibm, mysql, odbc Server to which to connect Database / Schema name User name. If -U and -P not supplied try to login using integrated security
User password Start new instance of SqlDbx. If -n not specified then pass arguments to the instance started wit none found then start new instance. Write debug log to SqlDbx.exe.log open specified script file if -q option specified then run loaded script load previously saved session state Clear registration information
Command line flags are not case sensitive and space after them is optional *Command line options are supported only in SqlDbx Professional Edition
You can enable automatic save / restore of SqlDbx session state by checking Enable Session State check box on Gen
Speed typing allows to create aliases for often used SQL blocks. For examples you can add string "sla" as alias for "s Typing Generate SELECT/UPDATE/INSERT/DELETE allows quickly to script SQL DML statements. If you want to quickly access object properties just click on object it in Editor and press Alt-F1 You can directly edit table data in Result Grid for tables with unique constraints Templates allow to organize snippets of code. Results Grid supports sorting and moving columns. Also it supports multiple selections. Hold Ctrl key while selecting Quickly select SQL block by placing cursor on first character and then press Ctrl+B
Quickly export data from table. Execute select * from <table_name>, then select everything in Grid Results by clicki Generate->Insert from right click menu Filter data in Results Grid by selecting Filter menu item from right click popup menu Replace Template parameters works not only for templates but with any text enclosed in angle brackets "<...>" You can directly execute procedures and functions from Object View pane You can execute procedures from Editor by righ clicking on procedure name
15
Results of any query operation will be put in a new Result Tab if you hold Shift key while selecting query action
database, you can use a scripting variable for the database name. Your define Script Variable by using following syntax: DEFINE var_name [=] [var_value] | [CHAR | VARCHAR | NUMBER | INT | INTEGER | NUMERIC | DECIMAl] where: = - optional assignment operator var_name - variable name var_value- optional variable value CHAR, VARCHAR, ... - optional variable type To reference script variable you use following syntax: for all databases except Oracle: $(var_name). In case of Oracle: &var_name Script variables can appear anywhere in text
Predefined Variables
SqlDbx defines following variables: $(TODAY) $(NOW) $(CURRENT_SCHEMA)
In Display query mode you can execute actions described below in a table. Generate SELECT/INSERT/DELETE/UPDATE for dates and string uses settings from Import / Export
Generates WHERE IN statement for current selection Generates ORDER BY statement for current selection Generates GROUP BY statement for current selection Generates CREATE TABLE statement based on current selection Allows to quickly change column display format Allows to quickly filter rows based on a value in current cell Allows to quickly retrieve Child / Parent rows rows based on a FOREIGN KEY constraint defined for selected rows Find in Results Copy selection to Clipboard. Data copied in two different formats Same as above only includes column names Copy only column names to Clipboard Export selection to Excel Export selection to File Switch column and rows Add new result tab if option Multiple Results Tabs enabled Delete current result tab Display query results in Grid Display query results in Text Switch column and rows Freeze columns to the left of current cell Display column type below header in Grid Show total for numeric columns in current selection
Column Format Filter Get Child / Parent Rows Find in Results Copy Copy With Column Name(s) Copy Column Name(s) Export to Excel Export to File Results Add Result Tab Delete Result Tab In Grid In Text Transpose Freeze Columns Show Column Types Show Column Totals
Notes
Generate feature by default copies generated statement to a current cursor position in Script Editor. If you hold Ctrl key down when using generate then statement will be copied at the end of current script
6. Options Options
Options Dialog is accessible from toolbar or Main Menu->Tools. General Options Editor Options Colors Results Options Scripting Options Import / Export Servers
6.1 General
General Options
Settings on this page control
6.2 Editor
Editor Options
This page contains settings for Script Editor
6.3 Colors
Color Options
This page allows to assign colors to different types of database objects. Also it allows to assign alternative background and text color for specific connections. Usually it used to differentiate connections to production and development servers. In order to use alternative colors you have to check "Use Alt. colors" on a Login dialog.
6.4 Results
Results Options
Results options
display time Thousands Separator Always Use '.' as Decimal Separator Trim Trailing Zeroes Do Not Use Date Format For Timestamps Grid Font Results Location Grid Colors Set Focus to Grid After Execute Multiple Result Tabs Show Column Types Rows Limit On Use thousands separator to format numbers Force dot as decimal separator Trim trailing zeroes Do not use date format to format TIMESTAMP columns Allows to select Grid font Allows to select where query results displayed Allows to assign background color to odd and even rows Set focus to grid after query completes Enable option to add Result Tabs. Applies to new connections Display column types under the header in Grid Maximum number or rows to retrieve
6.5 Scripting
Scripting / Log Options
These setting are used when Objects scripted from Object Pane
6.7 Servers
Servers Options
Server Options pages allow to specify settings for different servers. Oracle Help Sybase Help Microsoft Sql Server Help IBM DB2 Help ODBC Help
When connecting to database you can select which Oracle Home to use when connecting to Server. After first connection established all subsequent connections will use the same Oracle home regardless of what selected in Home combo box in Login dialog. Also you can create your own Oracle Homes in SqlDbx. It can be useful for example when Oracle Instant client used. User defined Oracle Homes can be added in Options dialog on Oracle page. String should consist of two strings separated by comma. First one specifies name for Home and second specifies path to a directory where OCI.DLL located. includes path to it.
You create bind variables with the VARIABLE command. For example
You reference bind variables in scripts by typing a colon (:) followed immediately by the name of the variable. For example VARIABLE ret_val NUMBER; BEGIN :ret_val := 2; END; After executing this block you will see output in grid automatically Using REFCURSOR Bind Variables REFCURSOR bind variables allow to fetch and display results of a SELECT statement contained in PL/SQL block or they can be used to reference PL/SQL cursor variables in stored procedures and functions. Also REFCURSOR bind variable can be returned from a stored procedure. VARIABLE employee_info REFCURSOR BEGIN OPEN :employee_info FOR SELECT EMPNO, SAL FROM SCOTT.EMP; END; After executing this block results automatically will be displayed in grid. Using REFCURSOR Variables in stored procedures CREATE PROCEDURE EmpReport (emp_ref IN OUT REF CURSOR) AS BEGIN OPEN emp_ref FOR SELECT EMPNO, SAL FROM SCOTT.EMP; END; VARIABLE rc REFCURSOR; BEGIN EmpReport (:rc); END;
SqlDbx supports SQ*Plus substitution variables with some minor differences. For details of how to use substitution variables click here Script Variables
Two different connections types supported for Sybase IQ and Sybase Anywhere: Open client and Sybase IQ ODBC driver. Both methods offer same features.
By default SqlDbx treats value in Server combo box as cataloged database alias. To connect to uncataloged DB2 databases please follow steps below. 1. Specify Server as HOSTNAME:PORT or HOSTNAME 2. In Options add the name of the database: DATABASE=dbname 3. Specify port if it was not specified in Server combo box. Example: Server: db2server Options: PORT=5023;DATABASE=dbname * Make sure that option values separated by semicolon ";"
Below is the example of how to call stored procedure on DB2 z/OS which has input and output parameters. The below code fragment was generated by selecting "Script Execute..." menu item. Leading underscore indicates that parameter value should not be part of returned results.
_COMMANDS 'DISPLAY THREAD(*)' VARCHAR IN _LEN_COMMANDS 200 INTEGER IN _PARSE_TYPE 'THD' INTEGER IN COMMANDS_EX INTEGER OUT IFCA_RET INTEGER OUT IFCA_RES INTEGER OUT XS_BYTES INTEGER OUT ERROR_MSG VARCHAR OUT
CALL SYSPROC.DSNACCMD (?_COMMANDS, ?_LEN_COMMANDS, ?_PARSE_TYPE, ?COMMANDS_EX, ?IFCA_RET, ?IFCA_RES, ?XS_BYTES, ?ERROR_MSG);
MySQL How To
Before you can connect to MySQL server you will need to download MySQL ODBC driver. You can install it but it is optional. The only requirement is that MySQL ODBC driver (myodbc5.dll) is located somewhere where SqlDbx can find it, for example in a same directory where SqlDbx.exe. Driver can be download from: MySQL ODBC Connector Download ZIP version with no install. Open it and extract file myodbc5.dll to SqlDbx or \Drivers directory. This will allow you to connect to MySQL by selecting it from "DBMS Type" combo box on the login screen There's two ways to specify port number if it is different from default (3306). 1. Specify Server name as SERVER:PORT 2. Add line PORT=port_number to Options edit box.
PostgreSQL How To
Before you can connect to PostgreSQL server you will need to download PostgreSQL ODBC driver. You can install it but it is optional. The only requirement is that PostgreSQL ODBC driver is located somewhere where SqlDbx can find it, for example in a same directory where SqlDbx.exe. Driver can be download from: PostgreSQL ODBC Driver Download ZIP version with no install. Open it and extract all *.dll files to SqlDbx or \Drivers directory. This will allow you to connect to PostgreSQL by selecting it from "DBMS Type" combo box on the login screen There's two ways to specify port number if it is different from default (5432). 1. Specify Server name as SERVER:PORT 2. Add line PORT=port_number to Options edit box.
Kdb+ How To
Before you can connect to Kdb+ server it is necessary to download and install Kdb+ ODBC driver from: Kdb+ ODBC driver download After you install ODBC driver there's two different way to configure access. 1. You can created DSN using using ODBC Manager (Access it from SqlDbx main menu: Tools->ODBC Administrator) and then use "ODBC" DBMS Type to connect to it 2. In Login dialog select DBMS Type "Kdb+" and in Server combo box enter server and port for KDb+ server, for example: SERVER1:5001. You can omit port number in Server combo box and specify it in Options edit box using following format: PORT=5001 It is also possible to configure SqlDbx to use Kdb+ ODBC driver directly without installing it. In this instance you need to copy qodbc.dll file to the same directory where SqlDbx.exe located or to a subdirectory named "Drivers" and then use the second method described above to connect.
=SQLTables (Catalog, Schema, ObjectType) =SQLColumns (Catalog, Schema, Table) =SQLSpecialColumns (Catalog, Schema, Table) =SQLPrimaryKeys (Catalog, Schema, Table) =SQLForeignKeys (Catalog, Schema, Table) =SQLProcedures (Catalog, Schema, ObjectType) =SQLProceduresColumns (Catalog, Schema, Procedure)
"Scripting Options" dialog displayed multiple times Multiple fixes for x64 version Procedure source not shown correctly (Sybase IQ, iAnywhere) Missing precision for DATETIME2 and TIME columns (SQL Server) Exception when exiting with results windows open Fixed incorrect display of UNIVARCHAR and UNICHAR columns (Sybase ASE) Exception when pasting text from other applications Incorrect system views used for some catalog queries (Oracle)
Fixes Exception when loading session state from unavailable network share Drop menu in Object Pane not working correctly when selecting multiple items Unable to connect to Sybase ASE when certain database administration tasks running Temp tables column not showing in Intellisense (Sybase, MS SqlServer) Incorrect scripting of GRANT TO PUBLIC Result Grid mode reset after each query Editor is not responsive in certain situations
Timeout connecting to DB2 on iSeries x64 version access violation when pasting from clipboard Spaces not handled correctly when using substitution variables
Improved handling of script variables Keyboard shortcuts to switch focus between different windows (Ctrl+1, Ctrl+2, Ctrl+3) Improved keyboard navigation Multiple small improvements in Editor Fixes Incorrect cursor position after search OUT parameters for SQL Server not scripted correctly Crash during restoring saved session Editor crashes when using bookmarks Inconsistent keyboard shortcuts
Fixed slow Intelliesense for Oracle and DB2 Fixed couple system catalog queries for DB2 z/OS
Fixed issue with Favorites not being saved in correct location Objects with names containing "." characters were not handled correctly ESC key was not closing some dialogs Visual data compare was not correctly ignoring trailing right whitespaces Improved usability and couple small improvements in different areas
Added display of return values for Sybase stored procedures Fixed small scripting errors for Sql Server and Oracle Fixed display of unsigned values for Sybase Version 15 Small GUI and Editor improvements
Added menu and shortcut keys for BEGIN, COMMIT and ROLLBACK TRANSACTION statements Added ability to switch AUTO COMMIT ON/OFF for DB2 and Oracle IBM DB2/UDB improvements Added support for DB2 UDB version 9.x Improved support for zOS and DB2 V7 SQL parser now better handles DDL an DML batches and recognizes --#SET DELIMITER command. See help for more details Admin queries added for versions 8.x and 9.x Intellisense recognizes DB2 Aliases Improved IntelliSense Editor now correctly applies color to multi line literal strings Fixed issue with Sql Server and DB2 reporting an error when delete, update or insert did not affect any rows Some minor GUI improvements and usability enhancements. Slight changes to menu structure Fixed Results Grid print preview
Editor performance significantly improved for very long lines Fixed loading of incorrect system tables and views for SQL Server 2005 Added shortcut to select SQL block (Ctrl+B). Shortcut for selecting text block changed to Ctrl+Shift+B Some other minor GUI enhancements and improvements
Now each script tab has it's own associated set of results Redesigned results window.
>Intellisense New auto suggest feature. Default shortcut key Ctrl+SPACE. Very basic at this time No popup lists and keyword capitalization inside comments SQL History feature completely redone New Quick search in script feature added More DBA related queries Fixed some menu and keyboard shortcuts Some minor GUI changes.
Option to limit number of returned rows. Option to see totals for numeric columns Fixed scripting of Sybase triggers Enable multiple selection in result grid. Copy and Generate statements use multiple selections. Generate WHERE IN (...) expression from result grid Minor improvements in editor, drag and drop, file handling