Tuesday, January 31, 2017

Importing a CSV file into SAP's SQL Anywhere 17

Importing data in csv files, from excel files and web pages are often required. Each software vendor have their own tools to import such data. In SAP's SQL Anywhere 17 you can import data in text files using the Interactive SQL tool.

For working with this post it is assumed you have installed SAP's SQL Anywhere 17 and you have an available csv file. For this post I will be using a text file created using the export-import wizard tool from a table in the Northwind database on a SQL Server 2012. You can of course use a suitable text file. Generating the FFD.txt file is described here (http://hodentekmsss.blogspot.com/2016/12/creating-csv-file-from-sql-server-2012.html).

The following is the procedure to import the text file into sql Anywhere 17.

From All Programs in Windows 10 click on Interactive SQL under SQL Anywhere 17.


This brings up the window 'Connect to a SQL Anywhere Database'.

Fill in the authentication information (dba\sql) and click Browse on the ODBC Data Source name and pick SQL Anywhere 17 Demo.

Click Tools and Test Connection to ensure you are connected.



SAP_1

Click Connect and you are connected to the demo database. Your personal server is running now as shown.

SAP_2


The Interactive SQL window should now be up with connection established to the demo database as shown.

SAP_3

Click Data | Import... to open the Pop-up window Import Wizard as shown.


SAP_4

Choose the default 'In a text file' and click Next to open the 'Select the file to import' page of the Import Wizard as shown.

SAP_5
Browse and locate the text file on your computer.

 Click Next.

Click Next.  In the next window use Comma as the field separator and insert check mark for 'The first line contains column names' as shown.

Click Next. The 'Use this panel to associate a database column with each imported column. Change datatype of the two date columns to 'time' from 'varchar'. You may highlight a column and change the data type, if it is not what you want. Here in is the drop-down for the Order Date.



Click Next. The "Where do you want to save data?" window is now open with two options. Choose to get the data into a new table and change default name of table to FFDImport. 

Click Import. The data gets imported.


The text data gets imported into the table FFDImport.

Close the Import Wizard.

The Interactive SQL window shows the SELECT * from the new table as shown.

SAP_11

Although the import was successful, the time related columns did not come through correctly. In the next post we shall see if we can correct this. For this post the 'varchar' data type for the OrderDate and RequiredDate were replaced by the 'time' data type in the Interactive SQL's, import data wizard.

The table is now visible in the SQL Explorer as shown.

SAP_12.png









Saturday, January 28, 2017

Hands-on Learning Event in Honolulu 1 : Introduction to Structured Query Language



Course summary:

Databases - organized repositories of information have become indispensable. Knowledge of databases is a must for professionals and in fact even more relevant since the emergence of Big Data in today's world.

In this introductory course you will learn all about relational databases and the basics of Structured Query Language (SQL) including sorting; grouping result sets; using DDL, DML, DCL, and TCL. All SQL statements will initially be written for one table. Most practical, modern and relational databases will include a large number of tables and SQL queries have to access information from several tables. This course will then introduce you to querying more than one table. With this skill you will be able to query two or more tables in a database. This is a hands-on course which will take you from installing SQL Server 2016; learning the ins and outs of SQL Server Management Studio and of course a full dose of SQL. You will be both coding as well using Graphical User Interface during this training.

During each meeting the students will be assessed for their knowledge, competency and proficiency in SQL.

Session start date and time: Feb 16 - March 23, TTH 5:30pm - 7:30pm 10 Meetings


Microsoft SQL Azure Database: SQL Server in Microsoft Cloud
Windows PowerShell for SQL Server
SQL Server 2016


You may also contact the instructor: hodentek@live.com