Win SQL Users Guide
Win SQL Users Guide
Copyright notice
Copyright 2010 Synametrics Technologies, a division of IndusSoft Technologies, Inc. and/or one of its subsidiaries. All rights reserved. Use of this documentation and related software is governed by a license agreement. This documentation and related software contain confidential, proprietary and trade secret information of Synametrics Technologies and are protected under United States and international copyright and other intellectual property laws. Use, disclosure, reproduction, modification, distribution, or storage in a retrieval system in any form or by any means is prohibited without the prior express written permission of Synametrics Technologies. This documentation and related software are subject to change without notice.
Publication date
August 2010
Reader comments
Any comments or suggestions regarding this publication are should be forwarded to the attention of: 666 Plainsboro Road Suite 656 Plainsboro, NJ 08536 or sent by e-mail to: [email protected]
Trademarks
WinSQL Professional is a registered trademark of Synametrics Technologies, a division of IndusSoft Technologies, Inc. Portions of this software are copyrighted by DataDirect Technologies. Windows is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other product or company names may be trademarks or registered trademarks of their respective companies.
ii
August 2010
Table of Contents
Table of Contents
About This Document ................................................ viii Document Conventions...................................................ix Chapter 1: Getting Started ........................................... 1 Overview ........................................................................... 1 Requirements ................................................................... 2 Installation and Set Up .................................................... 3 Obtaining a Serial Number ............................................. 4 Registering WinSQL Professional ODBC Drivers ....... 5 Configuring ODBC ........................................................... 7 Creating ODBC Connections..................................... 7 Establishing a Database Connection .......................... 10 Connection Strings .................................................... 11 Sample Connection Strings ..................................... 12 Connection Options .................................................. 17 Uninstalling WinSQL Professional .............................. 19 Customizing Shortcut Keys .......................................... 20 Chapter 2: Running Queries ...................................... 23 Overview ......................................................................... 23 Screen Layout ................................................................ 25 Integrated View .......................................................... 25 Classic View ............................................................... 26 Switching Views ......................................................... 26 Writing SQL Scripts ....................................................... 27 Query Pages ................................................................... 28 Query Set Workbook ................................................ 28 Using Clipboard.............................................................. 29 Extended Copy - Code ............................................. 29 Extended Copy - Results ......................................... 30 Displaying Query Results ............................................. 31 Modifying results displayed in Grid ......................... 32 Modifying results displayed in Text......................... 32 Modifying results displayed in Form ....................... 32 Viewing BLOB/CLOB Data ...................................... 33 Searching for Text ......................................................... 37
August 2010
iii
Table of Contents
Printing Results .............................................................. 39 Exporting Grid Content ................................................. 41 Intelli Tips ........................................................................ 42 Table Joins ................................................................. 43 Data Lookup ................................................................... 44 Configuring Data Lookup Display Options ............ 44 Modifying SQL Queries to Retrieve Data .............. 47 Drill-down Results .......................................................... 49 Query History.................................................................. 52 Comments with SQL Statements ............................ 52 Query Syntax and SQL Grammar........................... 52 Parameterized Queries ................................................. 54 Generate Code ............................................................... 55 SQL Wizard .................................................................... 57 Show Native SQL ...................................................... 57 Scripting Wizard ............................................................. 58 Chapter 3: Configuration Options ............................. 60 Overview ......................................................................... 60 General Tab .................................................................... 61 SQL Editor Tab .............................................................. 66 Editor Options Tab ......................................................... 67 Intelli Tips Tab ................................................................ 70 Advanced Options Tab ................................................. 71 Chapter 4: Supported Functions ............................... 73 Overview ......................................................................... 73 Scalar Functions ............................................................ 74 String Functions......................................................... 75 Numeric Functions .................................................... 77 Time, Date, and Interval Functions ......................... 79 System Functions ...................................................... 82 Chapter 5: Database Catalog ..................................... 83 Overview ......................................................................... 83 About the Database Catalog ........................................ 85 Database Catalog Caching ...................................... 85 Enabling Catalog Caching ....................................... 86 Viewing the Database Catalog .................................... 88 Exploring Objects in the Catalog............................. 89
WinSQL Professional User's Guide Release 8.5
iv
August 2010
Table of Contents
Providing Filters ......................................................... 89 Browsing Data ........................................................... 90 Using the Quick Math Feature................................. 90 Applying Filters .......................................................... 91 Adding User Comments ........................................... 91 Creating Local and Shared Comments .................. 92 Using the Insert/Update Record Wizard ..................... 94 Using Strings and Dates .......................................... 94 Ignoring Fields and NULL Values ........................... 95 Adding BLOB and CLOB Data ................................ 95 Managing Relationships ............................................... 97 Creating Local Relationships ................................... 97 Deleting Relationships .............................................. 99 Executing Stored Procedures .................................... 100 Using the New Table Wizard...................................... 101 Reverse Engineering a Table Design ....................... 102 Printing .......................................................................... 103 Database Search Wizard ............................................ 104 Using the Database Search Wizard ..................... 104 Chapter 6: Using the Database Task Scheduler .... 106 Overview ....................................................................... 106 About the Task Scheduler .......................................... 107 Types of Tasks ........................................................ 107 Creating a Task to Run a SQL Script ....................... 108 Chapter 7: Publishing HTML Pages ........................ 113 Overview ....................................................................... 113 Using Export Templates ............................................. 114 Creating a New HTML Template .......................... 114 Using an Existing HTML Template ....................... 117 Chapter 8: Using Database Diff ............................... 118 Overview ....................................................................... 118 Database Diff Wizards ................................................ 119 Schema Diff Wizard ................................................ 119 Comparing Objects Using Schema Diff ............... 124 Primary Objects and Detail Options ..................... 124 Data Diff Wizard ........................................................... 125 Comparing Objects Using Data Diff ..................... 128
WinSQL Professional User's Guide Release 8.5
August 2010
Table of Contents
Running Database Comparisons .......................... 129 Chapter 9: Generating Test Data ............................. 131 Overview ....................................................................... 131 Creating a Test Environment ..................................... 132 Starting the Test Data Generation Wizard .......... 132 Specifying Formatted Data ......................................... 138 Chapter 10: Entity-Relationship Diagrams ............. 144 Overview ....................................................................... 144 Creating an E/R Diagram ........................................... 145 Chapter 11: Exporting and Importing Data............. 148 Overview ....................................................................... 148 Exporting Data.............................................................. 150 Exporting Data to Another Data Source .............. 150 Connected ................................................................ 151 Disconnected ........................................................... 156 Importing a DataBag into a Target Database ..... 158 Quick Transfer to a Text File ................................. 161 Enhanced Transfer to a Text File ......................... 162 Exporting Data From an SQL Query .................... 166 Target table name ................................................... 168 Exporting to an External Database ....................... 169 Using Existing Templates ...................................... 172 Export to INSERT Scripts ........................................... 173 Exporting Data From a Table ................................ 173 Exporting to an Executable File ................................. 177 Generating Parameterized Executables .............. 182 Importing Text Files ..................................................... 185 Importing a Delimited Text File ............................. 185 Importing a Fixed Width Text File ......................... 189 Importing from Microsoft Excel .................................. 193 Chapter 12: Offline Backup/Restore ....................... 196 Overview ....................................................................... 196 Backing Up a Database .............................................. 197 Restoring a Database ................................................. 199
vi
August 2010
Table of Contents
Chapter 13: Database-Specific Plug-Ins ................. 203 Overview ....................................................................... 203 Overview of Database Plug-Ins ................................. 204 Chapter 14: Administrative Tasks ........................... 208 Overview ....................................................................... 208 Wizards Used For Administrative Tasks .................. 209 Available Wizards ........................................................ 210 Chapter 15: Command Line Processing ................. 212 Overview ....................................................................... 212 Command Line Options .............................................. 213 Command Line Syntax ........................................... 213 Command Line Examples ...................................... 214 Running Scripts From a Command Line .................. 216 Script Functions ....................................................... 216 Sample Scripts......................................................... 220 Troubleshooting Common Problems ........................ 222 Index ........................................................................... 223 Revision History ........................................................ 225
August 2010
vii
Audience
The WinSQL Professional User's Guide is designed for use by database administrators, system administrators, programmers, and other technical staff.
viii
August 2010
Document Conventions
The following conventions are used throughout this document: Convention
Keyboard keys and function keys Key combinations
Description
Begin with an uppercase letter and appear in bold type, enclosed in brackets; for example, [Enter] or [F1]. Are enclosed in brackets and appear in bold type If joined with a plus sign (+), press and hold the first and second key simultaneously; for example, Press [Ctrl+B].
Begin with uppercase letters and appear in bold type, for example, OK. Begin with uppercase letters and appear in bold type; for example, On the Edit menu, click Options. Begin with uppercase letters and appear in bold type; for example, the Configuration window is displayed. Are enclosed in angle brackets; for example, <file_name>. Are represented by a letter; for example, x.
In addition, the following special formats are used: Format Green text Indicates
a hyperlink to another section of this document or to a web site text of a message displayed in a window text that you must type in a window
Courier
Courier bold
August 2010
ix
Format
Bold
Indicates
a reference to a window or to an object in a window, such as an icon, field, or column; also indicates emphasis on a critical instruction or step a reference to another document; also indicates emphasis on certain words (Example: do not delete this file)
Italics
August 2010
In this chapter
This chapter contains the following topics: Topic
Requirements Installation and Set Up Obtaining a Serial Number Registering WinSQL Professional ODBC Drivers Creating ODBC Connections Establishing a Database Connection Sample Connection Strings Connection Options Uninstalling WinSQL Professional Customizing Shortcut Keys
See Page 2 3 4 5 7 10 12 17 19 20
August 2010
Requirements
WinSQL Professional is a 32-bit program that runs only on Microsoft Windows XP, Windows 2000, Windows 2003 and Windows Vista. It uses ODBC to connect to any target database for which a driver is available. WinSQL Professional requires that you use ODBC Manager version 3.x or higher. Although version 3.x is required as the ODBC Manager, you can use a driver that is compliant with version 2.x. However, if you use an older driver, you may not be able to use all of the features of WinSQL Professional. To confirm the version of ODBC Administrator currently installed, click Help, and then click About in the ODBC Data Source Administrator window. If version 3.x or higher is not installed, download the most current version from http://www.microsoft.com/data/odbc.
August 2010
Description
An installation program for WinSQL Professional. Extract the setup executable from the zipped file and follow instructions on the screen to install WinSQL Professional using this file. This is the recommended installation method.
WinSQLRaw.zip
This is a zipped file that contains all necessary executable files and ODBC drivers. However, this file does not contain an installer. Files must be manually copied to the directory of your choice, and the icons for the program must be manually created. Use this file if you are upgrading from version 4.7 or 5.0. If you have version 4.6 or earlier installed, we recommend that you uninstall and reinstall version 5.5. This file does NOT contain every file it only includes the main executable file and updated database plug-ins.
WinSQLUpgrade.zip
August 2010
August 2010
The WinSQL ODBC Installer window displays all the available drivers installed with WinSQL Professional. The installation status is displayed next to the name of every driver. You may choose to register only the drivers that you want to use, or select all of them. Synametrics Technologies recommends that you register all the drivers. Notes: To re-register or unregister a driver, click Help, and then click Register ODBC Drivers within WinSQL Professional. When drivers are unregistered, all associated data source names (DSNs) are also removed. WinSQL Professional works with all ODBC drivers, regardless of the manufacturer.
August 2010
Therefore, you do not have to register these drivers if you are planning to use a different driver to connect to your database.
August 2010
Configuring ODBC
Configuring ODBC and creating data sources is required before WinSQL Professional can be used for database management. The following topics describe these procedures.
Three different types of DSNs can be created: User DSN - These data sources are local to a computer, and may only be used by the current user. System DSN - These data sources are local to a computer, rather than dedicated to a user. The system, or any user having privileges on the system, can use a data source set up with a system DSN.
August 2010
File DSN - These are file-based data sources that may be shared between all users that have the same drivers installed and who have access to the database. These data sources are not machine- or user-specific.
Determine the type of DNS you need. The following steps, as an example, describe how to create an MS-SQL Server database (System DSN) connection: 1 2 From the ODBC Data Source Administrator window, click the System DSN tab. Click Add. The window that is displayed lists all the ODBC drivers installed on the computer. 3 Click to select SQL Server:
Click Finish. The following window is displayed: Note: The following screen may look different if you are connecting to a database other than MS SQL Server.
August 2010
5 6 7
Enter the desired name in the Name field. Enter an arbitrary description in the Description field. Enter the servers host name or IP address in the Which SQL Server do you want to connect to? field. Click Next.
Follow the instructions on the screen to complete this step. Depending upon the back-end database to which you are connecting, the screens may look different on your machine.
August 2010
10
August 2010
Connection Strings
A connection string is a set of connection parameters that tell WinSQL Professional how to connect to a remote database. If you want to use a connection string for connecting to a database, or if your application requires it, you must specify a DSN (data source name), a File DSN, or a DSN-less connection in the string. The difference is whether you use the DSN=, FILEDSN=, or the DRIVER= keyword in the connection string, as described in the ODBC specification. A DSN or FILEDSN connection string tells the driver where to find the default connection information. Optionally, you may specify attribute=value pairs in the connection string to override the default values stored in the data source. Beginning with ODBC Administrator version 4.0, a DSN is not required to establish a database connection. To use a connection string rather than a DSN connection, click the Specify connection string checkbox. The following window is displayed:
August 2010
11
Choose one of the following connection string types and use the accompanying format as an example for creating your entry: DSN connection, which uses the following format: DSN=data_source_name[;attribute=value[ ;attribute=value]...] File DSN connection, which uses the following format: FILEDSN=filename.dsn[;attribute=value[ ;attribute=value]...] DSN-less connection, which uses a specific driver instead of a data source, and uses the following format: DRIVER=[{]driver_name[}][;attribute=va lue[;attribute=value]...] If you are unsure about what to enter here, delete everything from the text box and click OK. The ODBC Driver manager window will display, and you can select the data source to which you wish to connect. WinSQL Professional captures the connection string that is used by the ODBC Driver manager and saves it for future use. The next time you establish connection, this text box will be completed for you.
DBase / FoxPro
Driver={Microsoft dBASE Driver (*.dbf)};Dbq=<c:\data>; Where <c:\data> is the folder where the files are stored
Firebird
DRIVER=Firebird/InterBase(r) driver;uid=sysdba;pwd=secret;dbname =<c:\data>\test.fdb
WinSQL Professional User's Guide Release 8.5
12
August 2010
Informix
Using WinSQL Professional Informix Wire Protocol DRIVER={WinSQL Professional Informix Wire Protocol};uid=yourID;PWD=secret;hos t=yourServerIP;port=1526;DB=YourDat abase;srvr=ol_yourdb Using Informix driver from IBM Driver={INFORMIX 3.30 32 BIT};Host=hostname;Server=myserver; Service=ol_yourdb;Protocol=olsoctcp ;Database=mydb;UID=username;PWD=myP wd Where <ol_yourdb> represents the server name from sqlhosts file on the Informix server
IBM DB2
Using WinSQL Professional DB2 Wire Protocol Driver Driver={WinSQL Professional DB2 Wire Protocol};Database=myDbName;IpAddre ss=myServerName;port=myPortNum;prot ocol=TCPIP;uid=myUserName;pwd=secre t Using IBM Driver Driver={IBM DB2 ODBC DRIVER};Database=myDbName;hostname= myServerName;port=myPortNum;protoco l=TCPIP;uid=myUserName;pwd=secret
August 2010
13
Mimer
Driver={MIMER};Database=yourDatabas e;uid=yourUserID;Pwd=secret;
MS Access
Standard Security Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\mydb.mdb;Uid=Admin; Pwd=; Workgroup Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydb.mdb;SystemDB=C :\mydb.mdw;
MS Excel
Driver={Microsoft Excel Driver (*.xls)};Dbq=c:\MyExcel.xls;Default Dir=c:\mypath;
MS SQL Server
Using SQL Server Security Driver={SQL Server};Server=YourServerIP;Databas e=YourDB;Uid=sa;Pwd=secret Using Trusted Connection Driver={SQL Server};Server=YourServer;Database= YourDBName;Trusted_Connection=yes Using TCP/IP with on a non-standard port Driver={SQL Server};Server=192.168.1.50,4321;ui d=sa;pwd=secret;Database=YourDB;
14
August 2010
MySQL
DRIVER={MySQL ODBC 3.51 Driver};server=YourServerIP;PORT=33 06;database=myDatabase;user=myUsern ame;password=secret;option=3
Oracle
Using WinSQL Professional Wire Protocol Driver Driver={WinSQL Professional Oracle Wire Protocol};host=tarzan;port=1521;Uid =scott; Pwd=tiger;sid=orcl Using WinSQL Professional Driver DRIVER={WinSQL Professional Oracle};uid=SCOTT;pwd=tiger;SRVR=or cl Using Microsoft Driver Driver={Microsoft ODBC for Oracle};UID=scott;PWD=tiger;SERVER= ORCL; In the previous two examples, the variable SERVER and SRVR refers to the name in TNSNAMES.ORA file on your machine. Note that WinSQL Professional Wire Protocol Driver, used in the first example, does not need TNSNAMES.ORA file. If you are using Oracles ODBC driver, the name of the driver is different on every machine. Refer to the ODBC Data Source Administrator to obtain the driver name.
Paradox
August 2010
15
Driver={Microsoft Paradox Driver (*.db )};DBQ=c:\data\;DefaultDir=<c:\data \>; Where <c:\data> is the folder where the files are stored.
PostgreSQL
Driver={PostgreSQL};Server=ipaddres s;port=5432;Database=yourDBname;uid =yourId;pwd=secret;
Sybase
Using WinSQL Professional Sybase Wire Protocol Driver={WinSQL Professional Sybase Wire Protocol};uid=sa;pwd=secret;NA=goof y,5000;DB=YourDatabaseName Using Sybase Open Client Driver Driver={SYBASE ASE ODBC Driver};Srvr=YourServerName;Uid=sa; Pwd=secret
Text Files
Using WinSQL Professional Text File driver Driver={WinSQL Professional Text File};DB=c:\data\ Using Microsoft Text Driver Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=c:\data\;Extensions=asc ,csv,tab,txt;
16
August 2010
Connection Options
Database Type / WinSQL Professional Plug-in
This connection option specifies the type of database to which you are connecting, and it also specifies a database plug-in. The names displayed in this list include the database plug-ins identified by WinSQL Professional when it is started. Choice of database type is only available in WinSQL Professional. For more information about plug-ins, see Database-Specific PlugIns later in this document. Important note: If the database to which you are trying to connect is not displayed in the list, it does not mean you cannot connect to that database with WinSQL Professional. It means that WinSQL Professional will not be able to query specific database features, such as triggers and SQL scripts for views and stored procedures.
August 2010
17
For more information, see the Database Catalog Caching topic later in this document.
18
August 2010
Note:
August 2010
19
Click the + (plus sign) by each of the menu options to display a submenu, illustrated as follows:
20
August 2010
Click to select an option. If a shortcut key exists for the option, it is displayed as follows:
If a new keyboard shortcut key is desired, press the key combination, and then click to select Overwrite existing values OR if a keyboard shortcut key does not exist, press the key combination. If accepted and not in use by another option, the selected key combination is displayed on the Customize Shortcuts window. If the select keyboard shortcut is already in use, the following information is displayed on the Customize Shortcuts window:
August 2010
21
Note: Any combination of control keys (Shift, Alt, and Ctrl), plus a letter or number, can be used. The only exception is Ctrl+[space bar], which is reserved for use by Intelli Tips.
22
August 2010
In this chapter
This chapter contains the following topics: Topic
Screen Layout Integrated View Classic View Switching Views Writing SQL Scripts Query Pages Query Set Workbook Using Clipboard Extended Copy Code Extended Copy - Results Displaying Query Results Intelli Tips Data Lookup Configuring Data Lookup Display Options Modifying SQL Queries to Retrieve Data
See Page 25 25 26 26 27 28 28 29 29 30 31 42 44 44 47
August 2010
23
Topic
Drill-Down Results Query History Comments with SQL Statements Query Syntax and SQL Grammar Parameterized Queries Generate Code SQL Wizard Scripting Wizard
See Page 49 52 52 52 54 55 57 58
24
August 2010
Screen Layout
WinSQL provides two different types of views (screen layouts) when viewing queries: Integrated View Classic View
Important note: For the purposes of this document, all procedural steps and screen shots refer to the Integrated View. However, Classic View screen shots are used in instances where they better serve to illustrate the function being performed.
Integrated View
When using the Integrated View, WinSQL displays part of the catalog screen next to the query window. This allows you to quickly and conveniently see the tables, views, and other objects in the database. The Integrated View is depicted in the following screen shot:
When you click a node that requires additional information, WinSQL automatically switches the current tab from Query to Catalog Details. For example, if you click the Browse Data or Manage Relationship nodes, WinSQL switches the current view to display the additional node information.
August 2010
25
Classic View
Unlike the Integrated View, the Classic View does not display the catalog screen. When in Classic View, you must click the Catalog tab to view catalog details. An advantage to using this view is that it provides more room to display the query and results tabs. The Classic View is depicted in the following screen shot:
Switching Views
To switch between integrated and classic views, simply click Switch to Integrated View or Switch to Classic View from the View menu. The text of the menu item changes based on the view you currently are using.
26
August 2010
You can highlight part of the script to run, or not highlight anything to run the complete script. If there is more than one result set, WinSQL Professional will display them one after another in different tabs.
August 2010
27
Query Pages
A query page is a group of SQL scripts displayed on the screen. You can have multiple query pages per window. Creating multiple query pages helps you manage queries when your SQL scripts get larger. The first query page is created automatically when you connect to a database. Thereafter, you have an option to create as many query pages as you need. The number of query pages allowed is limited only by available memory on the machine. To create a query page, point to the File menu, and then click New Query Page. The number of the current query page is displayed in the Available Query Pages field:
You can navigate to different query pages by selecting the desired query page from the Available Query Pages drop-down list.
28
August 2010
Using Clipboard
Results from queries can be copied to the Windows Clipboard by pressing [Ctrl+C]. The information copied to the Clipboard can then be copied into a variety of other software applications, depending on the type of output desired.
Convert to Code
This option allows you to write SQL code and convert that code into a third-generation language, such as C-Sharp, Visual Basic, or Java. Perform the following steps to convert SQL code: 1 2 Right-click the desired script in the Query window, and then click Extended Copy. Click Convert to Code. The SQL2Code Wizard window is displayed:
August 2010
29
4 5
If desired, change the default variable name in the Variable Name field. Click Copy to copy the text to the clipboard.
Copy to HTML
This option converts the SQL code into HTML, while retaining all syntax highlighting, and provides a convenient way of creating HTML documentation. To copy SQL statements into HTML, right-click the desired script in the Query windows, click Extended Copy, and then choose HTML.
30
August 2010
It is recommended that you display results in Grid unless you are running a query that returns large amount of text containing new line characters. Managing result sets that are displayed in Grid is much easier than in Text. For example, you can save the contents of the results Grid to a CVS, tab-delimited, or spreadsheet file. Note: The result is limited to 16MB of characters per cell when the data is displayed in a Grid control, 4096 characters when displayed in the Text control and 32 KB when displayed in the Form control. Since it is not practical to display the entire 16 MB of data in one grid cell, WinSQL will display a magnifying glass icon if the cell data is greater than 1024 characters. You may lick the magnifying glass to zoom and view the entire data. In case of text field, data will get truncated if the length is greater than 4096 characters. This will not happen if you try to export the field to another database. To select the method used to display query results, click the down arrow in the Execute Queries drop-down list, depicted as follows:
The resulting data display can be modified to include or exclude certain columns by click the X in the column header:
August 2010
31
This functionality is also available for the Browse Data Grid option available in the Catalog Details tab. Note: Right-click and select Display all columns to display formerly hidden columns.
32
August 2010
Several keyboard shortcuts can be used when the data is displayed in Form view. These shortcuts are described in the following table: Key combination
[Alt] + right arrow [Alt] + left arrow [Shift] + [Alt] + right arrow [Shift] + [Alt] + left arrow [Esc] [Enter]
Result
Displays the next record Displays the previous record Saves any modified data and displays the next record Saves any modified data and displays the previous record Discards any modified values and refreshes the window Saves the newly-modified values. This shortcut only works in single-line edit controls. Pressing [Enter] in a multi-line control inserts a new line in the data.
2 3
August 2010
33
If the object is a text object, the following information is displayed in the Zoomed data window:
Click the Rich Text tab to view the formatted text object:
34
August 2010
If the object is an image, click the Image tab to view the image:
August 2010
35
Click Close to close the Zoomed data window. If the binary object is not a rich text or image object and is, for example, a Microsoft Word document or an Microsoft Excel spreadsheet, click the Other tab to select the appropriate application to view the object, and then click Launch Application:
Note:
If your desired application is not listed, select <<Custom>> and specify the extension for your file. For example, if you have an AutoCad diagram saved in the database specify DWG as the file extension.
36
August 2010
August 2010
37
This window displays the columns contained in the Grid. You can either select the desired columns, or you can select the Search in ALL columns option to search within all Grid columns.
38
August 2010
Printing Results
Results displayed in a Grid can be printed in three different formats by right-clicking the displayed results, and then clicking Print Results. A window similar to the following is displayed:
After typing a title for your report in the Title field and selecting the desired column width and color option, select one of the available print format options, using the information in the following table as a guideline:
Option Tabular Description This option prints the data in a format similar to a spreadsheet. Pages are added sideways for additional columns and downward for additional rows. This is the best option for printing large amounts of data using the least number of pages. Best fit This option allows a row of data in a record to wrap to additional lines, allowing multiple records to be printed on each page. This is the best option for viewing multiple records in one page.
August 2010
39
Description This option prints one record per page in a format similar to a printed form.
40
August 2010
Select the desired export output, enter the desired file name in the Target File Name field, and then click OK.
August 2010
41
Intelli Tips
The Intelli Tips feature facilitates the writing of SQL queries by displaying the catalog objects in a pop-up window as the user types his/her queries.
By default, WinSQL Professional fetches the database catalog after the connection is established. This feature can be disabled for use with large databases; however, the database catalog must be manually fetched prior to using Intelli Tips. When Intelli Tips are enabled, Intelli Tips displays a window containing Table and Field as you type SQL script in the query window. You can also press [Ctrl+spacebar] to manually invoke the Intelli Tips window. The data displayed in the Intelli Tips window is pulled from the Catalog Details window. Therefore, any filter you have applied in the Catalog Details window applies to the data in the Intelli Tips window. The Intelli Tips window can display both tables and fields. WinSQL Professional parses the current query and displays the appropriate tab (tables or fields). To display columns for a particular table, click the Tables tab, select the desired table, and then click the Fields tab to display the fields within the selected table.
42
August 2010
Table Joins
WinSQL Professional recognizes relationships that are specified on your back-end server using foreign key constraints. In addition to foreign keys, you can also create a local relationship among tables. For more information, see Creating Local Relationships later in this document. When relationships are found among tables, the Intelli Tips window automatically displays the WHERE clause necessary for the JOIN statement, depicted as follows:
August 2010
43
Data Lookup
The Data Lookup feature in WinSQL Professional allows users to view the actual values in the tables when writing SQL queries. The value appears automatically when WinSQL Professional detects a WHERE clause in the query window, illustrated as follows:
44
August 2010
Use the information in the following table to specify the desired parameters: Field
Enable auto intelli tips Display delay time in milliseconds
Definition
If checked, Intelli Tips will be displayed automatically as you type your SQL queries. This is the amount of time WinSQL waits after a key is pressed before displaying the Intelli Tips window. This value is in milliseconds If checked, WinSQL will assign aliases for tables in the FROM clause. For example, if this NOT checked, the query will look like: Select Customer.Name from Customer When this is checked, the query will look like: Select c.Name from customer c
If checked, WinSQL will always enclose object names in quotes. The generated query will look like: Select *
August 2010
45
Field
Definition
From dbo.customer When this is NOT checked, WinSQL will only put quotes on objects that have an embedded space in their name.
Select one of the following options: Disable data lookup: Select this option if you wish to disable Data Lookup. Doing so will prevent the Data tab from appearing in the Intelli Tip window. Enable for every column: Select this option to enable data lookup for every column whose data type is one of the following: 1) numeric, 2) Date/time, or 3) character (where the length is less than the specific character length). Enable for columns that I choose: If this option is selected, you must specifically assign a SQL query to every column for which you wish to enable data lookup. To assign a SQL query, double-click that column in the Catalog Details window (see Enable for every column, above).
The number of records to display in the Intelli Tips window. If the query returns more than the specified number of records, they will be ignored. Data lookup is enabled for fields where the column length is less than this value. For example, if there is a remarks field in a table and its size is 255, Data Lookup is not enabled for this field. This value only applies to character
46
August 2010
Field
Definition
types.
For large databases, WinSQL Professional may take a long time to fetch records from a table. Therefore, if you specify a value other than -1, WinSQL Professional will only run data lookup queries for table having fewer numbers of rows than what you specify here.
August 2010
47
48
August 2010
Drill-down Results
When you run a query from a single table that has relationship, WinSQL Professional allows you to drill down to related rows in the associated table.
Consider the following scenario as an example, which contains a database with four tables. Their relationships are displayed in the figure below. Notice that the ORDERS table has two parents, EMPLOYEE and CUSTOMER, and it has one child, LINEITEM.
August 2010
49
When you run the following query in WinSQL Professional, it displays the columns containing primary and foreign key in a different color with a + (plus sign) next to the value. Note: The following illustration is in Classic View.
The first column in this example contains the primary key from the ORDERS table, which is displayed in red. The two subsequent columns contain data that map to the CUSTOMER and EMPLOYEE tables and is defined as a foreign key. Data for these columns is displayed in blue. You can click the + to display related data from the associated table. For example if you click the E_SSN column where the value is 50, WinSQL Professional will run another query that will pull the employees whose E_SSN equal 50, depicted as follows:
50
August 2010
August 2010
51
Query History
WinSQL Professional keeps a history of queries you have previously run. The default number of queries stored is 50; however, this value can be changed by clicking Configure on the History tab, and entering a new value in Modify historic count option. In addition, older queries are replaced by newer queries on a first in, first out basic. Historic queries can also be copied to disk for backup purposes.
Description
A line beginning with two dashes is consider a comment line Any text that is enclosed by /* /*
Beginning with WinSQL Professional version 3.5, you have the option of allowing WinSQL Professional to parse the comments before the SQL statement is submitted to the server. This option allows you to use comments that a back-end database may not support. Synametrics recommends that you allow the DBMS to handle supported comments. This option can be configured by pointing to the Edit menu and then clicking Options.
52
August 2010
If a query terminator is found within the script. The default value for query terminator is GO. You use a code template. Code templates are explained in more detail in the Database-Specific Plug-Ins topic in this document. Templates replace pre-defined tokens into server specific SQL. For example, when a user types DESCRIBE <TABLENAME> in an Oracle database, WinSQL Professional replaces this command with a set of Oracle specific scripts necessary to pull table definition.
August 2010
53
Parameterized Queries
Beginning with WinSQL Professional version 2.0, parameters can be accepted in queries. Any text that is preceded by two colons (::) is considered a parameter, and users are prompted to enter a value when the query is run. In addition, WinSQL Professional stores the values for previously-used parameters so that the user does not have to type them every time. Notes: Once a value has been specified for the first parameter in a query, you can press [Enter] to move to the next parameter. WinSQL Professional attempts to determine the data type for the subsequent parameters; however, the default data type can be determined by selecting a type from the list. Parameter queries cannot be used to export data.
54
August 2010
Generate Code
WinSQLs Generate Code function allows users to quickly generate one of the following SQL scripts: Select Insert Update Delete Create View Drop Table
Once selected, the script displays in the Query window. The primary keys in the selected table are, by default, used as parameter fields in the script and are indicated by a double colon (::). Note: The parameter field indicator can be modified, if desired. For more information, see the General Tab topic in Chapter 3, Configuration Options. Perform the following steps to use the Generate Code function: 1 2 3 4 Start WinSQL Professional and connect to the desired database. Click the plus (+) sign by Tables to view a list of tables in the catalog tree of your database. Click to select the desired table, and then right-click to display the submenu. Click Generate Code. A window similar to the following is displayed:
August 2010
55
Click the desired script. The content of the selected script is displayed in the Query window. In the following example, the SELECT statement was generated, and the primary key for the table (c_id) is the parameter field:
Notes: Parameter fields can be removed from the script as desired. When generating a new script, the highlighted content of the existing script displayed in the Query window is overwritten. If the cursor is positioned within the content of an existing script when a new script is generated, the new script is pasted at the current cursor position. 6 Click the Execute queries icon ( script. ) to run the
56
August 2010
SQL Wizard
The SQL Wizard, available in WinSQL Professional, allows you to create SQL queries with the help of a wizard, rather than creating queries by entering code. It allows you to select the desired tables and fields, and to apply filter conditions, before creating the SQL code for you. The SQL Wizard determines the referential integrity constraints specified against any table and draw appropriate relationships. Note: WinSQL Professional may not be able to determine referential integrity constraints in certain case where the ODBC driver does not provide necessary information, such as drivers for Microsoft Access. To activate the SQL Wizard, point to the Tools menu, and then click SQL Query Wizard.
August 2010
57
Scripting Wizard
WinSQLs scripting wizard allows users to select and execute multiple DML (INSERT, UPDATE, DELETE) or DDL (CREATE TABLE/VIEW/PROCEDURE) queries at one time, rather than executing them individuallyan often time-consuming process Important Note: Do not run SELECT queries using the Scripting Wizard. Perform the following steps to use the Scripting Wizard: 1 2 Start WinSQL Professional and connect to the desired database. From the Tools menu, click Scripting Wizard. A window similar to the following is displayed:
3 4
Click Add files to navigate to and select the SQL script(s) you wish to run. Click Execute to run the script(s). The Script Execution Wizard window provides information about the execution status of the running scripts, along with information about successful and
58
August 2010
unsuccessful query runs. This information is also written to a log file that can be saved and/or viewed using a standard text reader.
August 2010
59
In this chapter
This chapter contains the following topics: Topic
General Tab SQL Editor Tab Editor Options Tab Intelli Tips Tab Advanced Options Tab
See Page 61 66 67 70 71
60
August 2010
General Tab
To access configuration options available on the General tab, point to the Edit menu, and then click Options. The General tab is displayed:
The information in the following table describes each of the options available on the General tab:
Option # of records for browsing Description This is a numeric value corresponding to the number of records to display in the Browse Data feature available in the Catalog Details window. The default value is 100. Caution: If you set this value to a large number, WinSQL Professional will fetch a large result set whenever Browse Data is invoked. This can potentially slow down not only your machine but can also have negative affects on your network. Synametrics suggests that you instead apply filters on the records to limit the size of the returned results.
August 2010
61
Description This parameter limits the number of records that are returned from a SELECT statement. The default value is -1, which indicates no limit. This token string is used to specify a parameter in the query window. The default value for this field is: Example: The following query contains FirstName as parameter
Select * from customer where fName = ::FirstName
Parameter string
When this query is run, WinSQL Professional prompts for a value in the FirstName parameter field. Maximum errors allowed in export This option only applies to WinSQL Professional and specifies the number of errors allowed before an export routine is terminated. This value indicates the number of records to fetch before the screen is refreshed. This option is only applicable when results are displayed in Text control. If checked, the SQL statement is printed right before the result set. This is useful if you are displaying the result in the Text control.
62
August 2010
Description If checked, the SQL Query Wizard will use SQL 92 syntax for JOIN. Example: The following query is written in traditional SQL
* From Customers, Orders CWhere Customers.id = Orders.id
If checked, WinSQL Professional will use ODBC 3.0 compliant calls to the ODBC manager. Synametrics recommends that you leave this option unchecked unless your driver specifically requires it. If checked, WinSQL Professional will fetch the database catalog as soon as a new connection is established. Even though this option may cause WinSQL Professional to take longer to connect, the Intelli Tips feature will work as soon as you start typing your queries. When this option is unchecked, Intelli Tips will not work unless you fetch the catalog first.
An attempt is made to connect to the database if the connection is severed. If selected, queries are run in a second thread. It is strongly recommended that you leave this option checked (default).
Resultset Fonts
August 2010
63
Description Click the ellipses icon to change the font of the text displayed in the Result Set window. Note: To change the font of the text displayed in the Query window, point to the Edit menu, click Options, click the Editor Options tab, and then select the desired font.
If checked, all numeric values in the result set will be right aligned. This option is only applicable when results are displayed in Text control. If checked, warning messages are displayed. This option is most helpful if the database is either Sybase or MS-SQL Server, but it can also be used by other databases. Synametrics recommends that you select this option. If checked, WinSQL Professional will parse the query script and strip all the comments before submitting it to the back-end database. If checked, individual cells within a result grid cannot be selected. All columns for a row are selected. This string breaks the script in multiple parts, and each part is sent separately to the database. The default value for this parameter is GO, and it works in conjunction with the Terminator must be on a new line and Terminator string is case sensitive configuration options. If checked, a terminator string is only treated as a terminator if it appears on a new line.
64
August 2010
Option Terminator string is case sensitive Include create Index statements in DDL
Description If checked, the terminator string is case sensitive. If selected, WinSQL includes CREATE INDEX statements when reverse engineering a CREATE TABLE statements for a table. Selecting this option forces WinSQL to close the connection when Cancel is clicked while a query is running. If selected, WinSQL checks if the database has changed after running a query.
August 2010
65
Note: Font and Size apply to the entire SQL script and are not specific to any one element. Make any desired changes, and then click OK.
66
August 2010
The information in the following table describes each of the options available on the Editor Options tab:
Option Auto indent mode Description Positions the cursor under the first nonblank character of the preceding nonblank line when you press [Enter]. Inserts text after any selection. Inserts the tab character into the text when the user presses the [Tab] key. If this option is not selected, spaces are inserted instead. Tabs to the first non-whitespace character in the preceding line. Begins every auto-indented line with the least number of characters possible, using tabs and spaces as necessary.
August 2010
67
Description Aligns the insertion point to the previous indentation level (outdents it) when [Backspace] is pressed and when the cursor is on the first nonblank character of a line. Displays a non-editable area on the left hand side that displays line numbers. Highlights matching brackets when the cursor is between two brackets. Enables the arrow keys to move the cursor to the logical spaces within each tab character. Undoes your last editing command, as well as any subsequent editing commands of the same type, when you press [Alt]+[Backspace]. Allows the cursor to be positioned beyond end-of-file. Allows the cursor to be positioned beyond end-of-line. Retains any blanks you might have at the end of a line. Keeps marked blocks of text selectedeven when the cursor is moveduntil a new block of text is selected. Displays line numbers in the gutter area. Overwrites selected text with new text. Enables the selection of text when using the text editor.
Show Gutter
Group undo
Cursor beyond EOF Cursor beyond EOL Keep trailing blanks Persistent blocks
68
August 2010
Option Enable dragging Enable search highlight Force cut and copy enabled
Description Allows moving text by dragging it to a new position. Highlights text when using the Find and Replace function. If selected, cut/copy operations are enabled even if there is no text currently selected, and it clears the clipboard if performing a cut/copy operation without having first selected text. Wraps the line to the next line if it is too long.
Word Wrap
Once all selections have been made, click OK to save them and close this window.
August 2010
69
For detailed information about the options available on this tab, see the Configuring Data Lookup Display Options topic earlier in this document.
70
August 2010
The information in the following table describes each of the options available on the Advanced Options tab:
Option SMTP server host Description Host name for your SMTP server. This is used to send outbound email messages, which is used by the built-in scheduler. Often SMTP servers require users to login before relaying an outbound email. Specify your user id in this field. Specify your SMTP password. Outbound emails contain this value as the senders name. This is typically your name. Outbound emails contain this value as the senders email. This is typically your email address.
SMTP user
Sender email
August 2010
71
Description Specify the email address of the recipients who should get notifications when a scheduled task completes. If selected, BLOB and CLOB data are fetched automatically while browsing data. If selected, WinSQL treats a unique index as primary key if either one is not specified or the ODBC driver does not support this feature. If checked, Quick Math tip is displayed when you select more than one cell in the result grid that contains numeric values. The Quick Math tip displays the sum, maximum, minimum, and average values for the selected cells. This is maximum size for a grid cell before WinSQL will treat it as long data. If the content length of a cell exceeds this value, user must click the Zoom icon to view the entire data. This option affects how large data is inserted into the database when user tries to copy contents of a binary or large text file. Since large files are sent in chunks, this value specifies the size of one chunk. Most likely you should never have to change this value.
72
August 2010
In this chapter
This chapter contains the following topics: Topic
Scalar Functions String Functions Numeric Functions Time, Date, and Interval Functions System Functions
See Page 74 75 77 79 82
August 2010
73
Scalar Functions
In addition to supporting all functions supported by the back-end database, WinSQL Professional also supports ODBC scalar functions. In most cases, you will not need to use scalar functions since the back-end database usually has a richer set. However, in some cases, for instance when the source is a text file, you will find these functions extremely helpful. Following are the types of scalar functions: String functions Numeric functions Time and date functions System functions
The syntax for using scalar functions is as follows: {fn FUNCTION_NAME( PARAMETERS ) } The string {fn MUST precede the function name and a } must be followed after the close parenthesis. Example: select {fn SUBSTRING(first_name, 1, 3)} FirstThree, first_Name from customers where cust_id = 1049 This query displays the following result: FirstThree first_Name ---------Den ------------------------Denzil
1 Row(s) affected The FirstThree field only displays the first 3 characters of the name. Important note: Your driver may not support all of the functions listed below. Check the driver help file for a detailed listing of supported functions.
74
August 2010
String Functions
Function name
ASCII(string_exp)
Description
Returns the ASCII code value of the leftmost character of string_exp as an integer. Returns the length in bits of the string expression. Returns the character that has the ASCII code value specified by code. The value of code should be between 0 and 255; otherwise, the return value is data source-dependent. Returns a character string that is the result of concatenating string_exp2 to string_exp1. The resulting string is DBMS-dependent. For example, if the column represents by string_exp1 contained a NULL value, DB2 would return NULL, but SQL Server would return the non-NULL string. Returns an integer value that indicates the difference between the values returned by the SOUNDEX function for string_exp1 and string_exp2. Returns a character string where length characters have been deleted from string_exp1 beginning at start and where string_exp2 has been inserted into string_exp, beginning at the start. Returns a string equal to that in string_exp with all uppercase characters converted to lowercase. Returns the leftmost count characters of string_exp. Returns the number of characters in string_exp, excluding trailing blanks.
BIT_LENGTH(string_exp) CHAR(code)
CONCAT(string_exp1, string_exp2)
DIFFERENCE(string_exp1, string_exp2)
LCASE(string_exp)
August 2010
75
Function name
LOCATE(string_exp1, string_exp2, [start])
Description
Returns the starting position of the first occurrence of string_exp1 within string_exp2. The search for the first occurrence of string_exp1 begins with the first character position in string_exp2 unless the optional argument, start, is specified. If start is specified, the search begins with the character position indicated by the value of start. The first character position in string_exp2 is indicated by the value 1. If string_exp1 is not found within string_exp2, the value 0 is returned. Returns the characters of string_exp, with leading blanks removed. Returns a character string composed of string_exp repeated count times. Search string_exp1 for occurrences of string_exp2 and replace with string_exp3. Returns the rightmost count characters of string_exp. Returns the characters of string_exp with trailing blanks removed. Returns a data source dependent character string representing the sound of the words in string_exp. For example, SQL Server returns a 4digit SOUNDEX code; Oracle returns a phonetic representation of each word. Returns a character string consisting of count spaces.
SOUNDEX(string_exp)
SPACE(count)
76
August 2010
Function name
SUBSTRING(string_exp, start, length)
Description
Returns a character string that is derived from string_exp beginning at the character position specified by start for length characters. Returns a string equal to that in string_exp with all lowercase characters converted to uppercase
UCASE(string_exp)
Numeric Functions
Function name
ABS(numeric_exp) ACOS(float_exp) ASIN(float_exp) ATAN(float_exp) ATAN2(float_exp1, float_exp2)
Description
Returns the absolute value of numeric_exp Returns the arccosine of float_exp as an angle, expressed in radians. Returns the arcsine of float_exp as an angle, expressed in radians. Returns the arctangent of float_exp as an angle, expressed in radians. Returns the arctangent of the x and y coordinates, specified by float_exp1 and float_exp2. Returns the smallest integer greater than or equal to numeric_exp. Returns the cosine of float_exp, where float_exp is an angle expressed in radians. Returns the cotangent of float_exp, where float_exp is an angle expressed in radians. Returns the number of degrees converted from numeric_exp radians.
CEILING(numeric_exp) COS(float_exp)
COT(float_exp)
DEGREES(numeric_exp)
August 2010
77
Function name
EXP(float_exp) FLOOR(numeric_exp) LOG(float_exp) LOG10(float_exp) MOD(integer_exp1, integer_exp2) PI() POWER(numeric_exp, integer_exp)
Description
Returns the exponential value of float_exp. Returns the largest integer less than or equal to numeric_exp. Returns the natural logarithm of float_exp. Returns the base 10 logarithm of float_exp. Returns the remainder (modulus) of integer_exp1 divided by integer_exp2. Returns the constant value of pi as a floating point value. Returns the value of numeric_exp to the power of integer_exp. Returns the number of radians converted from numeric_exp degrees. Returns a random floating point value using integer_exp as the optional seed value. Returns numeric_exp rounded to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is rounded to |integer_exp| places to the left of the decimal point.
RADIANS(numeric_exp)
RAND([integer_exp])
ROUND(numeric_exp, integer_exp)
78
August 2010
Function name
SIGN(numeric_exp)
Description
Returns an indicator of the sign of numeric_exp. If numeric_exp is less than zero, 1 is returned. If numeric_exp equals zero, 0 is returned. If numeric_exp is greater than zero, 1 is returned.
SIN(float_exp)
Returns the sine of float_exp, where float_exp is an angle expressed in radians. Returns the square root of float_exp. Returns the tangent of float_exp, where float_exp is an angle expressed in radians. Returns numeric_exp truncated to integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is truncated to |integer_exp| places to the left of the decimal point.
SQRT(float_exp) TAN(float_exp)
TRUNCATE(numeric_exp, integer_exp)
Description
Returns the current date. Returns the current local time. Returns a character string containing the data source specific name of the day (for example, Sunday through Saturday or Sun. through Sat. for a data source that uses English, or Sonntag through Samstag for a data
August 2010
79
Function name
Description
source that uses German) for the day portion of date_exp.
DAYOFMONTH(date_exp)
Returns the day of the month based on the month field in date_exp as an integer value in the range of 1 31. Returns the day of the week based on the week field in date_exp as an integer value in the range of 1 7, where 1 represents Sunday. Returns the day of the year based on the year field in date_exp as an integer value in the range of 1 366. Returns the hour based on the hour field in time_exp as an integer value in the range of 0 23. Returns the minute based on the minute field in time_exp as an integer value in the range of 0 59. Returns the month based on the month field in date_exp as an integer value in the range of 1 12. Returns a character string containing the data source specific name of the month (for example, January through December or Jan. through Dec. for a data source that uses English, or January through December for a data source that uses German) for the month portion of date_exp. Returns current date and time as a timestamp value. Returns the quarter in date_exp as an integer value in the range of 1 4, where 1 represents January 1 through March 31. Returns the second based on the second field in time_exp as an integer
DAYOFWEEK(date_exp)
DAYOFYEAR(date_exp)
HOUR(time_exp)
MINUTE(time_exp)
MONTH(date_exp)
MONTHNAME(date_exp)
NOW() QUARTER(date_exp)
SECOND(time_exp)
80
August 2010
Function name
TIMESTAMPDIFF(interval, timestamp_exp1, timestamp_exp2)
Description
value in the range of 0 59. Returns the integer number of intervals of type interval by which timestamp_exp2 is greater than timestamp_exp1. Valid values of interval are the following keywords: SQL_TSI_FRAC_SECOND SQL_TSI_SECOND SQL_TSI_MINUTE SQL_TSI_HOUR SQL_TSI_DAY SQL_TSI_WEEK SQL_TSI_MONTH SQL_TSI_QUARTER SQL_TSI_YEAR where fractional seconds are expressed in billionths of a second. For example, the following SQL statement returns the name of each employee and the number of years he or she has been employed: SELECT NAME, {fn TIMESTAMPDIFF(SQL_TSI_YEAR, {fn CURDATE()}, HIRE_DATE)} FROM EMPLOYEES If either timestamp expression is a time value and interval specifies days, weeks, months, quarters, or years, the date portion of that timestamp is set to the current date before calculating the difference between the timestamps. If either timestamp expression is a date value and interval specifies fractional seconds, seconds, minutes, or hours, the time portion of that timestamp is set to 0 before calculating the difference between the timestamps. Important: Not all drivers support all of the intervals.
August 2010
81
Function name
WEEK(date_exp)
Description
Returns the week of the year based on the week field in date_exp as an integer value in the range of 1 53.
YEAR(date_exp)
Returns the year based on the year field in date_exp as an integer value. The range is data source dependent.
System Functions
Function name
DATABASE() IFNULL(exp_value) USER()
Description
Returns the name of the database corresponding to the connection. If exp is null, value is returned. If exp is not null, exp is returned. Returns the user name in the DBMS.
82
August 2010
In this chapter
This chapter contains the following topics: Topic
About the Database Catalog Catalog Caching Enabling Catalog Caching Viewing the Database Catalog Exploring Objects in the Catalog Providing Filters Browsing Data Using the Quick Math Feature Applying Filters Adding User Comments Using the Insert/Update Record Wizard Using Strings and Dates Ignoring Fields and Null Values Adding BLOB and CLOB Data Managing Relationships
See Page 85 85 86 85 89 89 90 90 90 91 94 94 95 95 97
August 2010
83
Topic
Creating Local Relationships Deleting Relationships Executing Stored Procedures Using the New Table Wizard Reverse Engineering a Table Design Printing Database Search Wizard Using the Database Search Wizard
84
August 2010
August 2010
85
Notes: If Enable catalog caching is selected at connection, WinSQL will load the catalog immediately after connecting. Therefore, the Load catalog after connection option on this window is disabled. When the catalog is loaded from cache, the word CACHED displays in the WinSQL status bar:
If the loaded cache is over 15 days old, the color of this word turns red (CACHED):
86
August 2010
This is a reminder that you should refresh the catalog. To refresh the catalog, you can either press F5 or click Refresh Catalog from the View menu. You can also click this indicator to determine how old this cache is.
August 2010
87
The objects in the Catalog Details window are divided into two categories: Common objects to all databases RDBMS specific object
The first category is available for all databases and is available in all editions of WinSQL Professional. However, the second category is only available in WinSQL Professional, and the contents depend upon the back-end database. Notes: The screen shot above displays a connection to MS-SQL Server and contains the databasespecific features you see if the database type is MS-SQL Server. Catalog information depends heavily on the capability of the ODBC driver. WinSQL Professional queries these drivers and
88
August 2010
determines which information is available. For example, the CLI drivers associated with the Informix client setup cannot display the parameters for a stored procedure.
Providing Filters
In some situations where the number of tables is very large, it may take a long time to display all the tables and their fields. The Catalog Details window provides two filtering parameters that can restrict the total number of objects displayed. These filters are: By user name - displays objects owned by this user By object name - displays objects where the name starts with the specified value
WinSQL Professional User's Guide Release 8.5
August 2010
89
Browsing Data
Click the Browse Data node to browse the first few records in a table or view. The default number of records displayed is 100; however, this value can be changed in the WinSQL Professional configuration options. Tip: Double-click the header of any row to sort the data by that row.
2 3 4 5 6
90
August 2010
The Quick Math window displays for approximately eight seconds. Repeat step 6 to display the Quick Math window again.
Applying Filters
You can restrict the records that appear in the Browse Data window by right-clicking and selecting Apply Filter on the data grid. The following window is displayed:
August 2010
91
2 3
2 3
92
August 2010
4 5
Enter the comment in the text area. If the WINSQLCM table does not yet exist, the following window is displayed, and you must click Create Table to continue:
August 2010
93
Click Execute to perform the insert or update, or click Close to close the record without making any changes.
94
August 2010
Column name
FirstName LastName ID CustSince
Data type
VARCHAR VARCHAR INT DATETIME
Value entered
Sarah $$NULL 430 4/25/1963 3:00 PM
Based on these values, WinSQL Professional generates the following query: INSERT INTO customers(first_name, last_name, id, custsince) VALUES ('Sarah', NULL, '430', DATETIME (196304-25 15:00:00.) YEAR TO SECOND) Notice that WinSQL Professional appropriately encloses the string value and formats the DATETIME field. Note: This example assumes that the database is Informix.
2 3
August 2010
95
4 5 6
Click the plus sign by the desired table. Click Browse Data. Right-click in the data window, and then click Insert new record. The following window is displayed:
Note: If any of the fields takes binary or long character data, click the icon in the cell and select either Load data from binary file or Load data from text file.
96
August 2010
Managing Relationships
WinSQL Professional exploits the foreign key constraints defined between tables in the back-end database. Several features, such as Intelli-tips Tips and Drill Down results, depend on this information. To manage relationships click on the Manage Relationship node in the Catalog Details window, depicted as follows:
August 2010
97
Use this window to define a new One to many or Many to one relationship between two tables. If you select One-to-many, it will create a new relationship where your selected table will become the parent. To create the selected table as a child, select Many to one. If the parent table does not contain any primary keys, WinSQL Professional will create a primary key locally meaning your back-end database will not be aware of this change. If WinSQL Professional does not acknowledge a relationship, the reason could be one of the following: The database designer has purposely chosen not to define foreign keys. Since foreign key constraints affect the performance of the database at run time, database designers often choose not to use them Either the database or the ODBC driver does not support this functionality. In this case, you can define a local relationship, which is local to WinSQL
98
August 2010
Deleting Relationships
To delete a local relationship, access the Manage Relationship window, right-click on a relationship line, and then click Delete Relation. To delete a remote relationship, you must write an ALTER TABLE statement against your database.
August 2010
99
Complete the appropriate input fields in the grid, and then click Execute. After execution, the output parameters appear in the grid control in red.
100
August 2010
4 5
Type a name for the table in the Table Name field. In the table grid, type the field names and select the desired data type and other options for each field.
As you type field values, WinSQL generates the CREATE TABLE statement for your new table.
August 2010
101
102
August 2010
Printing
The catalog information can be printed through the printing wizard in WinSQL Professional. By answering just a few questions, you can print the complete schema of a database in matter of minutes.
August 2010
103
2 3
Enter the search parameters and types of objects to search, and then click Search. Click the Search Results tab to view the results of your search:
104
August 2010
By default, the search is performed only on tables, columns, and their indexes. However, if you are connected to a database for which a plug-in is available, WinSQL Professional allows you to search views, stored procedures, triggers, and any other searching objects. For more information about WinSQL Professional plug-ins, see Chapter 12: Database-Specific PlugIns. 4 Click Close to close the Database Search Wizard window.
August 2010
105
In this chapter
This chapter contains the following topics: Topic
About the Task Scheduler Types of Tasks Creating a Task to Run a SQL Script
106
August 2010
Types of Tasks
Following type of tasks can be scheduled: Running SQL scripts Exporting data from one source to another target Exporting data to HTML files Running Data Diff and Schema Diff wizards
August 2010
107
Double-click Add New Task in the Existing tasks pane, OR click Add Task. The following window is displayed:
108
August 2010
Description
Name for this task Type of task to run Select an option from the drop down menu for the type of e-mail status message you wish to receive. Note: If you elect to send a status email, you must configure the outbound e-mail parameters by clicking Configure email server ( ).
August 2010
109
Field
Attach output file in email Inherit global settings for email recipients
Description
Click to select this option if you want to attach the output file in the status e-mail. Select this option to deliver a task status e-mail to all recipients that have been globally configured in WinSQL OR Clear this check box to send a task status e-mail to a select group of recipients. If this option is selected, a window displays that allows you to enter specific e-mail addresses.
Terminate WinSQL Professional once task is completed Script file name Output file name
Click to select if you want WinSQL Professional to terminate once the task has run. Name of the script file created and saved in step 2. The name of the file that contains the results (and any warnings or error messages) of the script.
110
August 2010
Complete the fields on the Email Server section of this window, and then click OK to close the window and return to the Schedule Task Editor window, where the newly-created task is displayed in the Existing tasks pane. Note: SMTP server host and Email recipient are required fields. All others are optional. If you are unsure how to complete these fields, contact your information technology (IT) department.
Ensure the desired task is selected, and then click Modify Schedule to assign a schedule to the task. Important note: WinSQL Professional is tightly integrated with the Windows operating system for task scheduling. Therefore, your login ID must have sufficient rights to run the desired task.
Click the Task, Schedule, and Settings tab to assign the desired options to the task. Notes: Consult the Windows operating system documentation or online help for further information about scheduling tasks.
WinSQL Professional User's Guide Release 8.5
August 2010
111
Confirm the system date and time are correct on your computer. Scheduled tasks rely on this information to execute tasks on a specified date and at a specified time.
112
August 2010
In this chapter
This chapter contains the following topics: Topic
Using Export Templates Creating a New HTML Template Using an Existing HTML Template
August 2010
113
114
August 2010
Click New, and then click Next. The following window is displayed:
The following is an example of a header file: <html> <head> <title>SQL query result</title> </head> <body bgcolor="#FFFFFF"> <!You can add more data here -->
August 2010
115
<div align="center"><center> <table border="0" cellpadding="2"> The following is an example of a footer file: </table></center></div></body></html>
This window allows you to specify the properties for the table header, table rows and table columns. The values in these fields must conform to HTML rules and must have a ::DATA parameter. ::DATA is replaced by the actual value when the export routine is run. Example Table Header: <th bgcolor="#000000"><font color="#FFFFFF"> ::DATA </font></th> Example Table Row: <tr BGCOLOR="#FFFFCC"> ::DATA </tr> Example Table Column: <td> ::DATA </td> Once all the necessary information has been entered, click the Next until the summary screen is displayed. Click Finish to publish the results.
116
August 2010
Click Browse to navigate to the location of the existing HTML export template (.HET file), and then click Open. Click Next under the summary window is displayed, and then click Finish to publish the results.
August 2010
117
In this chapter
This chapter contains the following topics: Topic
Database Diff Wizards Schema Diff Wizard Comparing Objects Using Schema Diff Primary Objects and Detail Options Data Diff Wizard Comparing Objects Using Data Diff Running Database Comparisons
118
August 2010
If this is the first time you are invoking the wizard, click New Or
August 2010
119
If you wish to use a previously saved template, click Existing. 3 4 Click Next. Select the first and second databases. Click the icon in the center of the screen to establish connection to both databases. Once the connection is established, the Connection icon changes to Disconnect, depicted as follows:
120
August 2010
This window is used to select the objects you wish to compare. The Primary Objects section of this window is used to display the primary objects contained within the database, such as: Tables Views Stored Procedures Database Specific Extensions
The Detail Options section of this window displays additional detail for the option selected in the Primary Objects section. The contents of this section changes based on the selection made in the Primary Objects section. For example, if you select Stored Procedures in the Primary Objects section, the Detail Options section will contain items to verify if you want to match the procedure script. The following additional options available on this window, and a description of each, is included in the following table: Option
Object name comparison
Description
If selected, comparisons
August 2010
121
Option
must be case sensitive Compare owner/schema of the object along with the name Run comparison with respect to both databases
Description
are case sensitive. If selected, the object owner is also matched. If selected, a comparison is run twice once for each database. When the comparison is run, WinSQL considers one database as the reference and finds out which objects are missing or different in the other database. If selected, multiple HTML files are created for output reports. It is highly recommended that you leave this option selected, particularly for large databases. If selected, matched objects do not appear in the report. Selecting this option greatly reduces the report size.
Once all options are selected, click Next. The following window is displayed:
122
August 2010
Reports are generated as HTML files, and they are displayed using the HTML browser configured on your system. The following is a description of the options available for generating reports: Use built-in style sheet If this option is selected, the generated report will use a built-in style sheet for HTML rendering. Header/Footer file If specified, WinSQL Professional uses the text contained in the specified file as the header and/or footer for the report. This is a convenient way to customize the look and feel of the generated report Match/Unmatch image This is the URL for the images displayed in the report. 7 Once all options are selected, click Next. The following window is displayed:
August 2010
123
124
August 2010
If this is the first time you are invoking the wizard, click New. Or If you wish to use a previously saved template, click Existing.
3 4
Click Next. Select the first and second databases by clicking the icons in the center of the screen. Once the connection is established, the Connection icon changes to Disconnect, depicted as follows:
August 2010
125
If you do not wish to specify any filter, leave the fields blank and every table will be selected. Click Next. The following window is displayed:
126
August 2010
WinSQL Professional displays tables and views on the left, while fields for the selected tables are displayed on the right. If a field has a primary key defined, WinSQL Professional will automatically put a key next to the name. In certain cases, such as when you select a particular view or your ODBC driver does not support primary keys, WinSQL Professional will not be able to automatically detect a primary key. In this case you must manually create one. To create a primary key you need to: Select the appropriate field Click the Toggle Primary Key icon .
Notes: Creating primary keys in this window does not have any affect on the underlying design of the table. If you wish to exclude any field from comparison select the field and either double-click it or click the Toggle field selection icon .
August 2010
127
Once all options are selected, click Next. The following window is displayed:
When comparing records, WinSQL Professional selects all records from the first table,, and then issues a SELECT query with appropriate WHERE clause in the second table. If a record is found, it then checks to see if the data in every field is identical in both tables. Since WinSQL Professional compares the design of every table in both databases while it is fetching, it can take a long time to fetch every object in the database. Therefore, it is recommended that you specify a filter if there are a large number of tables/views in your database.
128
August 2010
Next, type the location where you want the output generated in Report file name field. Finally, read the summary and confirm all settings are correct and then click Next.
August 2010
129
As with any other Wizard in WinSQL Professional, you can either save the template, or run the wizard without saving it.
130
August 2010
In this chapter
This chapter contains the following topics: Topic
Creating a Test Environment Starting the Test Data Generation Wizard Specifying Formatted Data
August 2010
131
132
August 2010
Example scenario
In order to understand all the steps required to create test data, the following example is provided, including the steps used during the process. The example scenario uses the following E-R diagram of a database table:
In this example, Microsoft SQL Server 7.0 is used, and all the data types reflected are for this type of database.
WinSQL Professional User's Guide Release 8.5
August 2010
133
The options on this window allow you to select fields and the data formats for the fields you wish to generate. Field names are displayed on the left side of the window.
134
August 2010
Description
This option generates completely random data. Although the text will not make any sense, this is the fastest method to generate data. This is the default value for all the fields except if there is a unique index on the field, in which case unique numbers will be generated. This option allows you to select the format of the data. Depending on the data type of the field, available options can change. For example, if the data type is DATETIME, you can specify the starting and ending date. Additionally, you can specify if you wish to include time along with date. For detailed information about how to use formatted data, see the Specifying Formatted Data topic.
Formatted data
This option is useful if you have a foreign key constraint defined that references another table. WinSQL Professional queries the ODBC driver to determine if any foreign key constraints are defined. If found, the program automatically selects this option with appropriate values for the fields. This feature depends heavily on the capabilities of the ODBC driver. For example, the ODBC driver for Microsoft Access does not return this information to the application, and users manually have to specify these values.
August 2010
135
Data source
Read from a text file
Description
Use this option to read data from a text file. This text file MUST have one row per line and can have multiple columns separated by a | (pipe) character. You can either sequentially read the file or assign records randomly. In the case of a sequential read, there MUST be enough records in the input file. Tokens Data in one text file can be a source for multiple columns. Consider the following scenario: You want to insert city, state & zip information in a table. If these three fields come from three different text files, there would be no relation between city, state and zip. This can cause New York City to become part of California with a zip code of Orlando, Florida. To avoid this situation, WinSQL Professional can read multiple fields from a text file. These fields are separated by a | (pipe) character and are called tokens. A sample text file can look like: New York City|New York|10001 Woodbridge|Virginia|22192 Palo Alto|California|94301
5 6
After your selections have been made, click Next. Based on your data source selection, different additional options as presented to you. Make sure selections, and then click Next. A summary window similar to the following is displayed:
136
August 2010
Select one of the following options: Run Only Run & Save Save Only
August 2010
137
String Formats
The following table specifies the rules for specifying format for strings: Keyword
/ # $ ^ @ % ~ *
Description
Escape character Numeric values Uppercase characters only Lowercase characters only Alphanumeric with uppercase letters Alphanumeric with lowercase letters Alphanumeric with mixed case letters This character MUST appear at the end, and it means that one or more characters can appear on the right side of the generated string
Cached records
When records are read from either a table or text file, WinSQL Professional reads a certain amount of rows in the memory. These records are called cached records. The default number of records in cache is 1000. Once enough records are generated, the program discards all the rows and refreshes the cache.
138
August 2010
In the above example, we have to insert 1000 records in the target table, and there are 1750 records in the input file/table. The specified percent cache is 40%, which means that WinSQL Professional will read 1000 rows from the table or text file and randomly pick records 400 values. Then, WinSQL Professional discards the cache data and fills it again with new values. However, the second time this operation is performed, there are only 750 records left in the input source. Therefore, the remaining 60% of the data will be created using the 750 records that are in the cache. Notice that the first field in the example, cust_id, is an AGN (automatically generated number), for which the database is responsible for assigning values. Synametrics recommends that you not change the value for this field. For the purposes of this example, a sample data file (SDF) is used as the data source. A few sample SDF files come with
August 2010
139
WinSQL Professional and are located in the folder where WinSQL Professional is installed. 1 2 3 4 5 6 7 8 Click the first_name field. On the right side of the window, click Read from a text file. Click Browse to select FirstName.sdf. Repeat steps 5-7 for the last_name field, selecting LastName.sdf as the file name. Click the city field. On the right side of the window, click Read from a text file. Click Browse to select citiState.sdf. Repeat steps 9-11 for the state and zip fields, using 2 and 3 for token numbers. Select the citiState.sdf file for the state and zip fields. This file contains fields for 3 columns. Click the phone field.
10 On the right side of the window, click Formatted data. 11 Select US Telephone Numbers from the list that is displayed. If additional formatting options are desired, select them from the list that is displayed. 12 Click Next. The following window is displayed:
140
August 2010
13 In the Number of records to be generated field, enter the number of records you wish to generate. There is no record number limit. Note: If the input source is a text file for any field and includes a sequential flag, you must have enough records in the SDF, or WinSQL Professional will restart from the beginning of the last batch and will create duplicate records.
August 2010
141
Ignoring a field
If you need WinSQL Professional to ignore a field for any particular reason, simply double-click the column name in the list box. This will cross out the field name and display it in gray text. Although ignoring a field is almost like setting the NULL percentage to 100, there can be situations where they can differ. Consider the following example: You have a table that is defined as: create table myTable( id autoNumber primary key, name varchar(30), phone varchar(15) ) In the case where the name field is ignored, WinSQL Professional will generate the following code: insert into myTable(phone) values("555-1212") However, if the field is set to produce 100% NULL values, the generated SQL will look like: insert into myTable(name, phone) values(NULL, "555-1212") In the above example, it does not matter if the name field is ignored or set to NULL. The output is the same in either case. However, if the table definition looked like following, there would be a difference:
142
August 2010
create table myTable( autoNumber primary key, name varchar(30), phone varchar(15) default '555-1212' id
August 2010
143
In this chapter
This chapter contains the following topic: Topic
Creating an E/R Diagram
144
August 2010
You can add a table either by double-clicking a table name or selecting it and then clicking Add. Click Add All to include every table in your database. The following screen shows the E/R diagram after all desired tables are included:
August 2010
145
The following table describes the actions available in the Entity/Relationship diagram window: Icon Description
Add New Table - Click to display a list of Tables and Views in your database. In the list that is displayed, select and double-click a table to add it in the diagram. Add New Relation Click to create a MasterDetail relationship between two tables. After you click this icon, the cursor changes to a hand. You MUST select the master table first and then the detail table. Zoom In - Click to enlarge the size of the image on the screen, as well as the printed output. Zoom Out - Click to reduce the size of the image on the screen, as well as the printed output.
146
August 2010
Diagram. Similarly, use the Open file icon to read a previouslycreated diagram.
August 2010
147
In this chapter
This chapter contains the following topics: Topic
Exporting Data Exporting Data to Another Data Source Connected Disconnected Text File Quick Transfer Enhanced Transfer Exporting Data From an SQL Query Exporting to an External Database Export to INSERT Scripts Exporting Data From a Table Exporting to an Executable File Generating Parameterized Executables Importing Text Files
148
August 2010
Topic
Importing a Delimited Text File Importing a Fixed Width Text File Importing from Microsoft Excel Troubleshooting Common Problems
August 2010
149
Exporting Data
WinSQL offers several ways to move data from once source to another. For example, you can: Copy contents of one table to another table in a different database Export data from table to a text file Import data from a text file to a database Generate INSERT INTO statements for an existing data. These INSERT statements can later be run against an empty table to insert data rows.
This section talks about different ways of importing and exporting data from one source to another target in WinSQL.
Export templates
Beginning with WinSQL Professional version 2.0, you can create export templates files to use at a later date. Additionally, these files are needed if you wish to run the export routines from a command line.
150
August 2010
Connected
Data can be exported from one table in the source database to a target table or from an SQL query against the source database to a target table. The section below describes how to use Drag-N-Drop to move contents of table from a source to a target: 1 Establish a connection between two databases. For more information, see Establishing a Database Connection. Click the Catalog Details tab. Click the plus sign by Tables in the source database. Click to select the desired table in the source database. While holding the left mouse button, drag the table to the target database. This action is illustrated as follows:
2 3 4 5
When the mouse button is released after dragging the table into the target database, the Data Export Wizard window is displayed:
August 2010
151
The Export to a new table in another database option is selected. By default, the table name is the same as in the source database but can be modified. Note: If the table exists in the target database, WinSQL automatically selects the Export to an existing table in another database. 7 Click Next. The following window is displayed:
152
August 2010
Ensure the displayed create table statement is correct, and then click Next. Note: WinSQL will convert, as necessary, data types between the two databases. If a particular data type is not supported in the target database, not supported is displayed in this window but can be modified to specify a data type that most closely matches. The following window is displayed:
August 2010
153
Note: In the previous illustration, the rows that have lines through them indicate that the columns be ignored. In this example, the user does not wish to export data for the last_name and street columns. 9 Ensure the data mapping between the two databases is correct, and then click Next. The following window is displayed:
154
August 2010
10 Ensure the export summary information is correct, and then click Finish. Note: If the export summary information is incorrect, click Modify Query to make the necessary changes. The data export begins, and status information is displayed during the process:
August 2010
155
Disconnected
The disconnected export option uses DataBags to complete the export. DataBags contain a local representation of schema and data from a table in a relational database. Using DataBags, WinSQL can recreate a table along with its data. Therefore, DataBags can be used for either database backup or to move data from one source to another in a disconnected mode. There are two ways to create DataBags: using table drag-anddrop, or using WinSQL menu options. These methods are described in the following sections. Once the DataBag is created, perform the steps described in this section to import the contents of the DataBag into the target database.
2 3 4
156
August 2010
Continue dragging the table to the desired option. If Drop here to create a DataBag to the default folder is selected, the following window is displayed:
Accept the default folder location by clicking Proceed. The following window is displayed:
August 2010
157
If you wish to view the contents of the DataBag, click Yes. If not, click No. The data export is completed.
Select the tables for which you wish to create the DataBag, and then click Export.
158
August 2010
Note: It is not necessary at this point to connect to the target database; the DataBag Export Wizard will guide you through establishing the connection during the data transfer. 2 From the Tools menu, point to Data To-Go, and then click DataBags Viewer. The following window is displayed:
Select the desired table, and then click Export Data. Double-clicking a table will also invoke the wizard. The following window is displayed:
August 2010
159
4 5 6
Click Connect to target database. Select the desired database connection, and then click OK. Click Next to continue. The following window is displayed:
Click to select the desired table, and then click Next. The following window is displayed:
160
August 2010
If you wish to run a SQL script either before or after the data transfer, enter the script in either/or the PreTransfer or Post-Transfer text areas. Click Next to continue.
10 If the information displayed in the Summary window is correct, click Finish to complete the data transfer. 11 A message is displayed indicated that the data transfer completed successfully. Click OK.
2 3 4
August 2010
161
5 6
Select the desired export format. Accept the default target file name, or modify it as desired, and then click OK. The data transfer is processed and completed.
2 3 4
162
August 2010
5 6
Note: Seleting Export to a new table in another database will prompt for the creation of an ODBC Data Source pointing to your text file. Creating a data source, rather than simply
WinSQL Professional User's Guide Release 8.5
August 2010
163
exporting to a text file, allows you to treat the text file as a database table and allows you to run SQL queries on the text. 7 8 9 Click Next. Enter a name for the new table, and then click Next. The ODBC Data Source window is displayed. If you do not have a pre-created DSN for text file, click ODBC Mgr. to create a text driver. The following window is displayed:
10 Click Add. 11 Scroll through the list that is displayed, and select WinSQL text file.
164
August 2010
12 Click Finish. 13 Complete the fields as desired in the ODBC Text Driver Setup window, and then click OK. 14 When the ODBC Data Source window is displayed, click to select the newly-created text driver. 15 Click OK. The Data Export Wizard window is displayed. 16 Modify the query as desired, and then click Next. 17 Modify the data mapping options as desired, and then click Next. 18 Ensure the export summary information is correct, and then click Finish. Note: If the export summary information is incorrect, click Modify Query to make the necessary changes. The data export begins, and status information is displayed during the process. When the export has completed, the following window is displayed:
August 2010
165
The SELECT statement can be a simple query fetching data from one table, or it can have multiple JOINS combining several tables with complicated WHERE clause. Notice that the only difference when exporting the result of a query verses exporting from a table is that in the latter case WinSQL Professional generates the SQL statement for you. This statement is a simple SELECT statement fetching all columns from
166
August 2010
the specified table. Therefore, the screens look very similar in both cases Note: Synametrics strongly recommends running the query and checking for syntax errors prior to invoking this wizard. As with any other WinSQL Professional wizard, you have a choice of creating a new template or use an existing template. The following window is displayed:
If this is the first time you are running this wizard, select Create a new export template. An export template stores all necessary information required to move data from one source to another target and, if saved, can be used for future exports. OR Select Use an existing template that you previously created.
August 2010
167
Use the following information to complete the options displayed on this window:
Description
This is the default option and will replace all new line characters with an ODBC compliant function call. Example: Lets say a field contains the following data. 1 Main Street Suite 130
168
August 2010
Option
Description
This data will be converted to '1 Main Street' + {fn CHAR(13)} + {fn CHAR(10)} + Suite 130 Notice the {fn CHAR(13)} statement, which represents an ODBC escape sequence for representing ASCII 13 and 10 characters.
Print as-is
Choosing this option will print the new line characters as-is, meaning the actual INSERT statement may appear in multiple lines. This option will ignore every row that has a new line character. This option will write the rows to the output, but these rows will be commented out. You can later uncomment them and run them manually.
August 2010
169
Note: Parameter queries cannot be used to export data. Once you are satisfied with the SQL script, point to the Query menu, click Export, and then choose one of the following options:
The following table describes each of the export options available in the Data Export Wizard window: Export option
Export to an external text file
Description
You can customize the export format in the following steps. These format options include delimiters and headers. This option does not use ODBC to create the text file. IMPORTANT: Synametrics recommends that you use this option if the data type of the columns in the table are either numeric, date time, or characters less than 512 in length. To save data containing binary fields or long character fields consider creating an ODBC DSN for Text and let WinSQL treat your text file as an table.
170
August 2010
Export option
current database
Description
in the target database. If you are trying to export the data in the same database, consider using an SQL UPDATE statement rather than using the Export Wizard. Use this option if the table does not exist in the target database. WinSQL Professional will create a CREATE TABLE statement, matching the data types as closely as possible. You can manipulate the generated script to add constraints or change the data types.
Notes: If you decide to export the data into a new table, WinSQL Professional generates the SQL statement for you. It is important that you not change the name of the target table in the script. If you need to change the name, click Back and replace the table name.
Export to an existing table in another database Export to a new table in another database
Use this option if the table already exists in the target database. This is similar to exporting to a new table in current database, except you are exporting to a different database.
August 2010
171
Use the arrow icons to move a target field up or down until it matches with the corresponding source field. If the fields dont match, either the data will get exported to incorrect columns or the export process will fail. By double-clicking a row you can exclude a column from the data transfer.
172
August 2010
Accept New, and then click Next. A window similar to the following is displayed:
August 2010
173
Select the desired options on this window, using the information in the following table as a guideline: Field
How do you want WinSQL to handle New Line characters? Note: These options define how NEW LINE characters appear in your text file. Since every record in the database appears in a line by itself, it is important to handle scenarios where a new line character appears in the data itself. These options allow you to choose how to handle them.
Description
Replace a new line with CHAR(13) _ CHAR(10 functions
A new line character in the data will be replaced by CHAR(13) + CHAR(10). For example, if the data in the database is: It is a nice day today It will be converted to: It is a nice + CHAR(13) + CHAR(10) + day today
Print them as is
No change will be made. You will see data in two lines.
174
August 2010
Field
Description
Comment out the row with a New Line character
Export the row but comment out the query. You can later correct the problem and re-run it.
If selected, a CREATE TABLE statement will also be printed beside the INSERT INTO statements. If selected, WinSQLs query terminator prints after every query. The default value for this option is GO. Select this option to create a template file. If selected, you must specify a file name in the Template File field.
5 6
Once the desired options have been selected, click Next. Click Finish to generate the script. A window similar to the following is displayed:
August 2010
175
Click Save to save the new script. You will be prompted to enter a new file name. Click Copy to copy the script to the Windows Clipboard. Click Close to close the Data Scripting Wizard window.
176
August 2010
Share the EXE file with other users, with no specific application requirements other than use of the Windows XP, Windows 2000, Windows 2003, Windows 2008, Windows Vista, or Windows 7 operating systems. Create an EXE file containing an unlimited number of rows of data that can easily be searched, sorted, and printed. This data can be copied and pasted into other applications, such as Microsoft Excel, for further manipulation and analysis. When this EXE file is run, it will allow users to Print a report based on the data Search data Copy data and paste into applications like Microsoft Excel Double-click the column header to sort the data Show or hide desired columns
No other file is required to run the executable if it is static. An ODBC driver is required if the executable is created as dynamic.
Prerequisites
No prerequisites exist for static executable files. WinSQL creates a self-contained file that runs on any machine without installation and does not need any other file in order to run.
WinSQL Professional User's Guide Release 8.5
August 2010
177
When you create a dynamic executable, the generated file must connect to the database at run time. This means you must have the ODBC driver installed on the target machine. Due to installation complexities and licensing issues, the generated file does not include the ODBC driver. Additionally, you must specify a valid connection string that is used to establish connection to the database. There are two types of connection strings: Contains a data source name (DSN) Contains the ODBC driver name
If you expect the same DSN on the target machine, you can have WinSQL copy the parameters of your existing connection to the generated executable. If the same DSN does not exist on the target machine, you must specify a connection string containing the driver name. A connection string contains parameters as name-value pairs. For more information, see the Connection Strings topic in this document. Perform the following steps to create an EXE file: 1 Select a query, and display the query results in grid form. For more information, see Displaying Query Results. A window similar to the following is displayed:
178
August 2010
Right-click within the results grid in this window, and then click Save to executable:
August 2010
179
In the Specify a connection string field, type the connection string you wish to use to connect to the database. If you expect the same DSN to be available on the target machine, you can select the Use existing connection attributes check box.
180
August 2010
Complete the fields on this window, using the information in the following table as a guideline:
Option Executable Title Description Type a name to use as the title for this EXE file. This name displays when the EXE file is generated. Use this field (optional) to type comments about the EXE file. These remarks display on the Messages tab in the generated EXE file. Select this option to include the SQL query in the EXE file. Select this option to save all grids in the query in the resulting EXE file. Specify the name of the EXE file name. If you do not wish to save the EXE file in the default location, click Browse to navigate to another location.
Remarks
August 2010
181
Once all options have been selected or entered, click OK to create the EXE file. The file is created in the specified location and can now be shared with other users. The following screenshot depicts a generated EXE file:
Notice that the screen shot above looks similar to WinSQL's result grid. In reality, it belongs to the generated executable. Similar to WinSQL, multiple result sets are displayed in different tabs, allowing the user to select the desired results. If the generated executable is dynamic, the data is refreshed when the executable is run. For any reason, if this executable is not able to connect to the database to fetch fresh data, it will act as if it were a static file, displaying stale records.
182
August 2010
Perform the following steps to create a parameterized executable: 1 Use the information in the Parameter Queries topic provided in this document to create your parameter query. The following is an example of a query using ::EnterRegion as a parameter that will prompt the user to supply a value when the query is run:
SELECT * FROM Customers WHERE region = ::EnterRegion
2 3
Execute the query. With the query results displayed, right-click within the Resultset window, and then click Save to executable. A window similar to the following is displayed:
4 5
Click the Dynamic Executable icon, and then click Next. A window displays providing information about the perquisites and the connection string required to run the executable. If you are unsure what to specify for the connection string, click Help me create a connection string.
WinSQL Professional User's Guide Release 8.5
August 2010
183
7 8 9
Type the desired name for this executable in the Executable Title field. If necessary, click Browse to navigate to and select the location where you wish to save your query. Click Finish. The executable is now available for delivery
184
August 2010
Note: You can also invoke the Text Import Wizard by opening Windows Explorer, navigating to and selecting the text file you wish to import, and then dragging it to the WinSQL Catalog window. 2 3 Click New. Click Browse.
August 2010
185
4 5 6 7
Navigate to the location containing the text file you wish to import, select the file, and then click Open. Click Open. Click Next. Ensure the Delimited format is selected:
186
August 2010
Choose the appropriate delimiter that separates the text in your file.
10 If your file contains field names or column headings, click to select the First Row Contains Field Names check box. 11 Once all options have been selected, click Next. The following window is displayed:
12 Select In a new table if you wish to import the data into a new table in your database. If this option is selected, you must type a name for the new table in the blank field. OR Select In an existing table if you wish to import the data into an existing table in your database. If this option is selected, you will be prompted to select the table in which you wish to import the data. 13 Click Next. A window similar to the following displayed:
This window displays a CREATE TABLE statement that defines the design of the new table, allowing you to make modifications, if desired.
August 2010
187
Note: You may make changes to the field types or lengths, but do not modify the table name. 14 If all field types and lengths are correct, click Next. The following window is displayed:
15 Click Finish. Note: If you wish to save this import as a template, either browse to or select an existing template file, and then click Finish. The data is imported, and a message similar to the following is displayed:
188
August 2010
Note: You can also invoke the Text Import Wizard by pointing opening Windows Explorer, navigating to and selecting the text file you wish to import, and then dragging it to the WinSQL Catalog window. 2 3 4 5 6 7 Click New. Click Browse. Navigate to the location containing the text file you wish to import, select the file, and then click Open. Click Open. Click Next. Ensure the Fixed Width format is selected:
August 2010
189
Click the green plug (+) icon to add fields from your import file, and then specify the starting position for each field added. Field lengths are automatically calculated.
10 Once all fields have been selected, click Next. The following window is displayed:
190
August 2010
11 Select In a new table if you wish to import the data into a new table in your database. If this option is selected, you must type a name for the new table in the blank field. OR Select In an existing table if you wish to import the data into an existing table in your database. If this option is selected, you will be prompted to select the table in which you wish to import the data. 12 Click Next. A window similar to the following displayed:
13 If all field types and lengths are correct, click Next. Note: You may make changes to the field types or lengths, but do not modify the table name. The following window is displayed:
August 2010
191
14 Click Finish. Note: If you wish to save this import as a template, either browse to or select an existing template file, and then click Finish. The data is imported, and a message similar to the following is displayed:
192
August 2010
Note: You can also invoke the Import Wizard by opening Windows Explorer, navigating to and selecting the Excel file you wish to import, and then dragging it to the WinSQL Catalog window. 2 3 4 Click Browse to navigate to the Excel workbook. Click to select the file, and then click Open. Click Next. A window similar to the following, containing a preview of the Excel data, is displayed:
August 2010
193
If your workbook contains multiple worksheets, click the down arrow in the Desired worksheet field to select a worksheet. Click Next If you wish to import your Excel data into an existing table, select the Import to existing table option, and then click the down arrow to select the desired table OR Accept the default option, Import to a new table, to import your Excel data into a new table. If this option is selected, WinSQL will suggest a CREATE TABLE statement that you can modify, illustrated as follows:
6 7
194
August 2010
Important Note: If you wish to change the name of the new table, type the desired name in the text field next to the Import to a new table option. Do not modify the table name in SQL script. 8 Click Next, and then click Finish. WinSQL will read the Excel data and import it into the selected or new table in the database.
August 2010
195
In this chapter
This chapter contains the following topics: Topic
Backing Up a Database Restoring a Database
196
August 2010
Backing Up a Database
WinSQL offers an offline backup utility that can be used in place of your native backup utility. One of the primary advantages of using WinSQLs backup utility is that it offers the flexibility of backing up one type of database and, if desired, restoring to a different type of database. Additionally, WinSQLs backup utility is always available and is not dependent on outside resources, such as an ISP backup service whose resources are shared by many users. Important note: WinSQLs backup utility is limited to backing up only certain objects in the database, such as tables, views, stored procedures, and triggers. Other database-specific objects, such as user logins, user defined data types, and sequences are not eligible for back up. Perform the following steps to back up a database: 1 Connect to the database you wish to back up. For more information, see Establishing a Database Connection. From the Tools menu, point to Offline Backup, and then click Backup. A window similar to the following is displayed:
August 2010
197
Accept the default option to back up all objects in the database OR Click the Let me pick the object I want to back up option. If this option is selected, you must click to select the check box by each object you wish to back up.
Accept the default backup file name and location, or click browse to select another location and/or file name. Click Back up. When the backup has completed, a window similar to the following is displayed:
If you wish to view the backup file, click Yes. Otherwise, click No to close this window.
198
August 2010
Restoring a Database
Perform the following steps restore a database: 1 Connect to the database you wish to back up. For more information, see Establishing a Database Connection. From the Tools menu, point to Offline Backup, and then click Backup. A window similar to the following is displayed:
Click Browse to navigate to the location where your backup file is located, click to select the file, and then click Open. Note: If the source database type is different from the target database, WinSQL displays a warning message that only data will be restored. In such cases, you cannot restore views, stored procedures or triggers.
August 2010
199
Click Restore all objects in the database OR Click the Let me pick the object I want to restore option. If this option is selected, you must click to select the check box by each object you wish to restore.
Once all options have been selected, click Next. A window similar to the following is displayed:
200
August 2010
Verify the order in which the objects will be restored. If necessary, click the Up and Down arrows to rearrange the objects. Note: The restoration order is important in cases where tables are related to each other. For example, assume that the Orders table contains a field that refers to the primary key in the Customer table. In this case, you must restore the parent table prior to restoring the children tables.
Click Drop existing tables in the target database to allow the restore process to create new tables in your database OR Do not select this option to allow the restore to append data from the backup file to the existing database tables.
10 Click Abort operations if an error occurs to prevent the restore from continuing to run if an error is encountered during the restore. 11 Click Restore.
WinSQL Professional User's Guide Release 8.5
August 2010
201
202
August 2010
In this chapter
This chapter contains the following topic: Topic
Overview of Database Plug-Ins
August 2010
203
204
August 2010
August 2010
205
The second image shows how the nodes in the tree are reduced when a generic plug-in is used:
Notice that you do not see any other node after Supported Data Types. This is because information for all other nodes comes in from the plug-in.
206
August 2010
August 2010
207
In this chapter
This chapter contains the following topics: Topic
Wizards Used for Administrative Tasks Available Wizards
208
August 2010
Index
Most of these wizards depend upon the functionality supported by the back-end database, and certain wizards may not be available for certain databases. For example, the TEXT driver does not support index creation. Therefore, running the Create New Index wizard for a TEXT data source would result in errors.
August 2010
209
Available Wizards
The following table describes some of the wizards available in WinSQL Professional: Wizard Name
Create New Index
Description
This wizard is invoked by selecting Create New Index from the drop down menu after clicking Admin Tasks. Although this option is available for most data sources, some back-end sources, for example, TEXT driver, may not support it. Plug-in enabled databases, such as Oracle, MSSQL Server, DB2, Sybase, Informix, Mimer, PostgreSQL, MySQL and others use a databasespecific syntax for CREATE INDEX and support extensions that are not available in other RDBMS. For example, if you are connected to an MS-SQL Server database, you can create a CLUSTERED index.
Rebuild Index
This wizard is invoked by selecting Rebuild Index from the menu when an index is selected.
You can only rebuild an index if it is NOT associated with a primary key. Rebuilding any index requires dropping and recreating the same index again. Most RDBMS do not allow dropping an index if it is associated with a primary key. Generating DDL scripts WinSQL Professional allows you to generate DDL scripts for tables, views, triggers and stored procedures. You can either select one object at a
210
August 2010
Index
Wizard Name
Description
time, or you can use the DDL Scripting wizard to selectively pick the object. To pick one table at a time, select the table from Catalog Details window, and then click Generate CREATE TABLE Statement.
To use the DDL Scripting wizard, point to the Tools menu, and then click Generate DDL Scripts. Select the desired type of objects from this window, specify a file name where the script will be saved, and click Start.
August 2010
211
In this chapter
This chapter contains the following topics: Topic
Command Line Options Command Line Syntax Command Line Processing Examples Running Scripts From a Command Line Script Functions Script Samples
212
August 2010
Index
Value
NULL
Description
Close WinSQL Professional automatically after the task is complete. Contains the name of the ODBC DSN. If there is a space in the name, it must be enclosed in quotes. Runs WinSQL Professional in debug mode. Will create a debug.log file that can be used to pin point any potential problem.
-d
DSN Name
-g
NULL
August 2010
213
Option
-o
Value
Output file
Description
This file is used to store any error messages or data returned from the server as a result of a query execution. If this option is not specified, there will be no output generated. Name of the file that holds the SQL query. User password for database connection User name for database connection Name of the export template file. Name of the HTML template file. Displays a help dialog box displaying all the command line options
-q -p -u -x -h -?
Query File Password User Name Export template Publish HTML NULL
Example 2
The following example opens a file in the editor but does not run it. WinSQL c:\student.sql
214
August 2010
Index
Example 3
The following example exports the data based on a template file called StudentTemplate.wet. WinSQL xStudentTemplate.wet -a Notice that you do not have to provide a user id, password and DSN name when specifying a template file because this information is embedded in the template file. If you need to change any parameters in the template file, use the Export Template File Editor on the Tools menu.
August 2010
215
Lines starting with two dashes are considered comments and are ignored at run time. Empty lines are ignored. Function names are case-sensitive and must include open and close parenthesis, even if parameters are not required. Parameters must be enclosed in double quote characters.
To run the simply pass the file name containing a script as a command line argument to WinSQL, for example: winsql MyScriptFile.wxf
Script Functions
The following is a list of available functions you can write in a script. Note that each function begins with wnsFunc_. Function
Function Name Description
Name/Description/Parameters
wnsFunc_AutoLogin Establishes a connection to a database. This should be the first function in your script This function takes three parameters in the following order:
Parameters
1.
216
August 2010
Index
Function
Name/Description/Parameters
connection string. 2. 3. User ID - Login ID for the user. Set this value to a -1 if the first parameter is a connection string., Password - Set this value to -1 if the first parameter is a connection string.
wnsFunc_AutoTerminate Terminates WinSQL's process. This should be the last function in your script. Any script appearing after this function is ignored. If you skip this function, WinSQL will run the script and will display an empty window at the end. There are no parameters for this function. wnsFunc_DataDiff Runs the Data Diff wizard for the given template file. You must use the Data Diff Wizard in WinSQL and create a template before using this function. For more information, see the Data Diff Wizard topic in this document.
Uses the name of the Data Diff template file name as the parameter. wnsFunc_ExportData Runs an export template. You must create an export template using WinSQL's GUI. For more information, see the Using Export Templates topic in this document.
Parameters
Expects one parameter, which is the name of a template file. For more information, see the Using Export Templates topic in this document.
wnsFunc_ImportText Runs a text import template. You must create an import template using WInSQL's GUI. Expects one parameter, which is the name of a template file.
August 2010
217
Function
Name/Description/Parameters
For more information, see the Importing Text Files topic in this document.
wnsFunc_HtmlExport Exports to HTML file(s) based on a template. You must create an HTML export template using WinSQL's GUI. For more information, see the Using Export Templates topic in this document.
Expects one parameter, which is the name of a template file. wnsFunc_RunScript Runs any SQL script saved in a file. Multiple queries can be used, separated by a query separator. Uses two parameters in the following order.
Parameters
SQL file name - Name of the file containing SQL queries. Output file name - This file will contain results from a SELECT queries and/or record affected count for DML and DDL queries.
wnsFunc_SchemaDiff Runs schema diff wizard for the given template. You must create a Schema Diff template using WinSQL's GUI. Fore more information, see the Schema Diff Wizard topic in this document.
Expects one parameter, which is the name of a template file. wnsFunc_SendStatusEmail Sends a status e-mail. This function is overloaded, meaning it can take either 2 parameters or 5 parameters, described as follows:
Parameters
218
August 2010
Index
Function
Name/Description/Parameters
1. E-mail option - This can either be 1, 2, or 3. If this value is 1, an e-mail is only sent when the status of every previous task is successful. If this value is 2, an e-mail is only sent when any of the previous tasks generates an error. When this value is 3, e-mail is sent regardless of the error status. 2. Attachments - Name of the file(s) to be attached. Multiple file names can be attached, separated by three pipe characters (|||). You can use $FILE_ATTACHMENTS string as the name of a file if the file name should be determined from the previous script. For example, when you run an Export template to a text file, the name of the output file is read at run time. Refer to the script samples following this table. Note: This function obtains the recipient and sender e-mail addresses from the WinSQL global configuration, which can be set by selecting Options from the Edit menu in WinSQL. Five Parameter Version: 1. 2. 3. E-mail option - same as above Attachment - same as above Recipient E-mail address of the recipient. Multiple addresses can be added, separated by a comma. Sender name - Name of the sender Sender e-mail E-mail address of the sender
4. 5.
Note: In either parameter version, the body of the email is generated by WinSQL and is based on the tasks that are run prior to calling this function. Function Name Description wnsFunc_ExportDataBag Exports data stored in a Databag to a table, This method takes 5 parameters in the following
August 2010
219
Function
Parameters
Name/Description/Parameters
order. 1. 2. 3. 4. 5. Databag File name Target DSN User ID for the connection Password for the connection Target table name
wnsFunc_SwitchDatabase Switches the connection context to a different database. This function is only meaningful when your back-end database supports this concept. For example, Microsoft SQL Server and Sybase support switching to a different database, but Oracle does not. Takes one parameter containing the desired database name.
Parameters
Sample Scripts
Example 1
This script run SQL scripts saved in a file named BackupDB.sql. -- Establishes connection to a database.The DSN name is 'testData' -- User id is scott and tiger is the password wnsFunc_AutoLogin("testData", "scott", "tiger") -- Switch the database to a different value wnsFunc_SwitchDatabase("Northwind") -- Following function will run the scripts in BackupDB.sql file -- Output logs are saved to BackupDB.out file wnsFunc_RunScript("C:\data\BackupDB.sql", "C:\data\BackupDB.out") -- Send status email if the script fails or succeeds wnsFunc_SendStatusEmail("3",
WinSQL Professional User's Guide Release 8.5
220
August 2010
Index
"C:\data\BackupDB.out") -- Terminate WinSQL wnsFunc_AutoTerminate() Assuming the above script in saved in a file named TestScript.wxf, the following command will execute the script: c:\Program Files\Synametrics Technologies\WinSQL\winsql "c:\data\TestScript.wxf"
Example 2
This script runs an export template that exports data from a table to a text file. The name of the generated text file is automatically read from the export template and is attached to the e-mail. This is done by specifying $FILE_ATTACHMENTS as a file name in wnsFunc_SendStatusEmail function. Of important note in this example is the fact that you do not have to call the wnsFunc_AutoLogin function. This is because the connection parameters are specified in the export template file, which is 24Hour.wet in this case. -- Execute export routine wnsFunc_ExportData("C:\data\24Hour.wet") -- Send status email wnsFunc_SendStatusEmail("3", "$FILE_ATTACHMENTS") -- Finally terminate WinSQL wnsFunc_AutoTerminate()
August 2010
221
Example 1
WinSQL xStudentTemplate.wet dStudentDSN uAdmin pAdmin
You cannot specify any other parameter along with x. The template file stores all the necessary connection parameters.
Example 2
WinSQL dStudentDSN uAdmin qc:\updateStudents.sql oc:\output.txt -a
Here, the p option for password is not specified. If WinSQL Professional does not see a p option, it will prompt the user for a password. If the password is blank or your database does not need a password, you must still provide this parameter with no value specified.
222
August 2010
Index
Index
Browing Data Filter .................................................................. 90 Browsing Data .......................................................... 90 Command Line Options ........................................... 214 Connection Options Auto-commit transactions .................................... 17 Database Type.................................................... 17 Data Diff ................................................................ 125 Database Actions Backing up ....................................................... 197 Exporting from .................................................. 150 Importing to ............................................. 185, 193 Restoring .......................................................... 199 Database Catalog Definition............................................................ 85 Filters ................................................................. 89 Printing ............................................................ 103 Database Catalog Caching ......................................... 85 Enabling at connection ........................................ 86 Document Conventions......................................................... ix Product and version .............................................. ii Exporting Data From a table ..................................................... 173 From an SQL query ........................................... 166 Overview .......................................................... 150 To a parameterized executable file ..................... 182 To an executable file ......................................... 177 To an external database .................................... 169 To another data source ..................................... 150 To INSERT scripts ............................................. 173 Functions Date andTime ..................................................... 79 Numeric ............................................................. 77 Scalar ................................................................. 74
August 2010
223
Index
String ................................................................. 75 System ............................................................... 82 Importing Data From Microsoft Excel ......................................... 193 ODBC File DSN ...............................................................8 System DSN .........................................................7 User DSN..............................................................7 Queries Catalog Tip ......................................................... 42 Comments .......................................................... 52 Parameter .......................................................... 54 Workbook ........................................................... 28 Results Displaying in Grid, Text, or Form View .................. 31 Reverse Engineering ............................................... 102 Schema Diff ............................................................ 119 Scripts .................................................................... 217 Creating a task to run a script ............................ 108 Examples.......................................................... 221 Generate Code for............................................... 55 Running from command line .............................. 214 Script functions ................................................. 217 Scripting Wizard .................................................. 58 SQL Wizard......................................................... 57, 58 Stored Procedure .................................................... 100 Views ....................................................................... 25 Classic ................................................................ 26 Integrated .......................................................... 25 Wizards Data Diff .......................................................... 125 Insert/Update ..................................................... 94 New Table ........................................................ 100 Schema Diff ...................................................... 119 Scripting Wizard .................................................. 58 SQL Wizard................................................... 57, 58 Stored Procedure .............................................. 100
224
August 2010
Revision History
Revision History
The following changes have been made to this document since the August 2009 release (v8.0): Topic
Scripting Wizard Generate Code Importing from Microsoft Excel Generating Parameterized Executables
Change
New topic added to Chapter 2 New topic added to Chapter 2 New topic added to Chapter 11 New topic added to Chapter 11
August 2010
225