BLOG ARCHIVES

  • HOW TO GET A SIZE OF COLUMN IN MYSQL

    AUTHOR: // CATEGORY: Development, mySQL, Open Source

    No Comments

    So last week I got an email from our host saying a database has received its maximum size of 3GB. I was like what? How? So I quickly ran the below to check which column was causing the problem.

    If you want to find out the size of column=COLUMN_NAME from table=TABLE_NAME, you can always run a query like this:

    SELECT sum(char_length(COLUMN_NAME))FROM TABLE_NAME;
    
    

    Size returned is in bytes. If you want it in kb, you could just divide it by 1024, like so:

    SELECT sum(char_length(COLUMN_NAME))/1024FROM TABLE_NAME;

    Happy querying.

  • BIGDUMP SQL IMPORT

    AUTHOR: // CATEGORY: Development, Open Source

    No Comments

    So … sometimes you on shared hosting and you need to import a large database. Problem phpmyadmin only supports a max of > 50MB. So the first option is to check the php.ini or the cursed .htaccess file – however many times shared providers override these or won’t allow an apache restart immediately.

    So in comes BigDump SQL Import (http://www.ozerov.de/bigdump/)

    Usage

    1. 1- Download this file or from the http://www.ozerov.de/bigdump.zip
    2. 2- Open bigdump.php in a text editor, adjust the database configuration and dump file encoding.
    3. 3- Drop the old tables on the target database if your dump doesn’t contain “DROP TABLE” (use phpMyAdmin).
    4. 4- Create the working directory (e.g. dump) on your web server
    5. 5- Upload bigdump.php and the dump files (*.sql or *.gz) via FTP to the working directory (take care of TEXT mode upload for bigdump.php and dump.sql butBINARY mode for dump.gz if uploading from MS Windows).
    6. 6- Run the bigdump.php from your web browser via URL likehttp://www.yourdomain.com/dump/bigdump.php.
    7. 7- Now you can select the file to be imported from the listing of your working directory. Click “Start import” to start.
    8. 8- BigDump will start every next import session automatically if JavaScript is enabled in your browser.
    9. 9- Relax and wait for the script to finish. Do NOT close the browser window!
    10. — IMPORTANT: Remove bigdump.php and your dump files from your web server.

     

    Credits to http://www.ozerov.de/bigdump/usage/

    Happy importing

  • SQL ANYWHERE SERVICES FROM COMMAND PROMPT

    AUTHOR: // CATEGORY: Development, PC

    No Comments

    Start up SQL Anywhere Services from command prompt on NT

    There are cases when customer would like to start up a SQL Anywhere Services at a specific time or after a database backup. The following is a way to start up a SQL Anywhere Services from outside Sybase Central or NT Services (as in Control Panel, Servi
    1. Open the 32-bit registry editor (C:\WINNT\system32\regedt32.exe).

    On the taskbar, click on “Start” then select “Run”. Type in regedt32 or regedit.

    1. Double click on HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services

    1. For ASA versions 6.x.x/7.x.x/8.x.x, scroll down until you see ASANY. For SQL Anywhere version 5.x.x, scroll down until you see SQLANY. Any services created in SQL Anywhere Service Manager (or from Sybase Central) should be listed here.

    1. The name of each individual service would appear as

    ASANYx_y or SQLANYx_y

    where ‘x’ represents the Service Type:


    a – Sample Application

    c – Client
    e – Standalone Engine
    l – Agent for Replication Server

    o – Open Server Gateway
    r – SQL Remote Message Agent

    s – Network Server

    and ‘y’ represents the Service Name as seen in the ‘Name’ column in Sybase SQL Anywhere Service Manager.

    Find out which key is for the service you want to start from the DOS prompt. Write down the name of the key. Note that the key is

    Case sensitive for version 5.x.x but is not case sensitive for version 6.x.x/7.x.x/8.x.x.

    1. In DOS, the command to start up any registered NT Services (which include SQL Anywhere/Adaptive Server Anywhere Services) is ‘net start’.

    Therefore, the syntax to start up a SQL Anywhere Service from a command prompt (DOS prompt) would be:

    net start <key for the service from registry editor>
     

    1. Similarly, the NT command to stop any registered NT Services is ‘net stop’  


    Therefore, the syntax to stop a SQL Anywhere/Adaptive Server Anywhere Service from a command prompt (DOS prompt) would be:


    net stop <key for the service from registry editor>

    Credit to: http://www.sybase.com/detail?id=10915

  • ONLINE DUPLICATE CHECKER

    AUTHOR: // CATEGORY: Development, Open Source, PC

    No Comments

    Ever have a list of data and want to quickly check for duplicates. Now I know it’s possible in SQL or even Excel but if you looking for a really easy online way without tweaking check out http://www.somacon.com/p568.php – Paste your data in the form click on Display / Update Counts and view the results …

    Happy duplicate checking …