WinSQL and MS-Dos Short Names

When you use dos short names as a comment in first line of WinSQL scripts -- the query page dropdown can store this. I find it helpful when running a series of related scripts then to keep a dos window open and do a 'DIR /X' (list short-names).

Click on the image for a clearer view of this...

Using multiple CONCAT( functions

One of the things I do quite often in mySQL is CONCAT( but this is a messy function. That is, unless you think ahead a little.

First present your items to concatenate as items in select:

SELECT
        '-- delete_orphaned_refund_mod_rows.for.'
        ,&txn_response_date
        ,'.to.'
        ,&txn_response_date2
        ,'.on.'
        ,DATE_FORMAT(NOW(),'%Y-%m-%d.%I.%i')
        ,'.sqL'
;
...then format as so:
SELECT
        CONCAT
        (
        CONCAT
        (
        CONCAT
        (
        CONCAT
        (
        CONCAT
        (
        CONCAT
        (
        '-- delete_orphaned_refund_mod_rows.for.'
        ,&txn_response_date
        )
        ,'.to.'
        )
        ,&txn_response_date2
        )
        ,'.on.'
        )
        ,DATE_FORMAT(NOW(),'%Y-%m-%d.%I.%i')
        )
        ,'.sqL'
        )  as "-- delete_orphaned_refund_mod_rows" 
;
...if the SQL client you use (I use WinSQL) does paren matching you can easily see everything is matched -- but, visually, it's relatively clear as well.

-Cheers

Two Kornshell functions

I'm new to Unix Kornshell.  So, if these two functions I've created 
aren't "best practice" let me know.  

I find them useful.  The first deletes files created today - the second
finds/displays files created today.

Example use:
  How...

function dtoday
{
 mon=`date|cut -d" " -f2`
 dd=`date|cut -d" " -f3`
 ls -l ../*/*.*|grep "$mon $dd"|cut -c55-140>dtoday.txt
 grep -v "today" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v "my" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v "zArchive" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 grep -v ".ksh" dtoday.txt>dtoday.2.txt
 mv -f dtoday.2.txt dtoday.txt
 file="dtoday.txt"
 # while loop
 while read line
 do
 echo "rm -f $line"
 rm -f $line
 done <"$file"
 rm -f dtoday.txt
}
function ftoday
{
mon=`date|cut -d" " -f2`
dd=`date|cut -d" " -f3`
ls -l ../*/*.*|grep "$mon $dd"
}

Favorite Tweets