SQL

Handling Large SQL Files, Locally

Those fun moments when you have to import SQL that are 100s of MB large to accommodate development of existing projects. Getting your local setup completed can be a hassle if you try to go the UI route of using phpmyadmin or similar to handle the import. Save yourself the time go straight to the

// SQL //
Read More

Database Statistics

Ever wonder how much space your database is utilizing? Usually something we don’t give much thought to, however if you are looking into migrating hosting then it is something you may need. I tend to work on a lot of WordPress Sites that utilize MySQL databases and the below 2 queries I have found to

Using the Describe command of IBM DB2 to get column data types

Ever find yourself working in an unfamiliar Database or table and in need of knowing what are the data types for the different columns? Well that recently happened to me when I had to expand some queries in a DB2 environment. As it turns out there exists the Describe command that outputs the columns of

// DB2 // How To //
Read More

Multiplying a Database Column’s Values

Like most individuals I find the built int SUM function of SQL very helpful when performing computations. Recently however I found myself wondering how to compute the product of a result set grouped by some factor, and I found myself slightly at a lost as no Product function exists. Fortunately for us we can use

Subtle but required syntax when writing a DB2 WHERE clause

While continuing my exploration into the world of DB2 databases, I found myself confused as to why my basic SELECT … WHERE … statement were failing when I tried to do AND/OR clauses. After a little fumbling around I found the solution… parentheses. Parenthesis? you ask, yes. Simply put when you want to write a

// DB2 //
Read More

How to limit rows returned in a DB2 database

Back from an extended vacation and I find myself in the middle of a project needing to export data from a DB2 database. Fortunately I have decent knowledge of SQL and the basic syntax matches up but then I found myself wanting to limit the results returned. Now in T-SQL and MySQL I often would

// DB2 //
Read More

Using iSQL to connect to Sybase Databases via the Command Line

In most instances you will be using a User Interface of one sort or another to execute Transact-SQL commands against your Sybase Database Servers. In rare occasions however I find that I execute commands through the dos prompt via the Interactive SQL Utility or iSQL as it is more commonly referred. Opening a Connection BCP

// DOS // T-SQL //
Read More

Using the BCP utility to input and output data to/from Sybase

When performing database maintenance you will occasionally find the need to export data out of your database tables to an operating system for storage, or conversely import data to a table from a file. You may find yourself needing to do these tasks for data backup or for inserting data that comes from a 3rd

// DOS // T-SQL // Tools //
Read More

Optimizing T-SQL Procedures – Utilize same datatypes as is in the table

Today I was running some tests on my T-SQL Procedures and noticed that for some reason my Select statement was performing in seconds compared to my Procedure which would take minutes to complete. After a few hours I stumbled upon my mistake I had used the date datatype in the procedure parameters when my database

How to perform a batch delete in T-SQL

Database maintenance can be a full -time job when working within a large corporation. Cleanup or deletion of records can especially be time-consuming and error prone when dealing with large data tables with millions of records. Often developers will try to run a basic delete statement without knowing about batching or truncating the activity log.