All posts by Mark Jacobsen

Generate a GUID or UUID in DB2

Want to generate the equivalent of a GUID or UUID in DB2? The closest you’ll get is with GENERATE_UNIQUE(), but beware that you need to do some conversion on it as the value is “BIT DATA” and not character data. To put the value into a typical CHAR or VARCHAR field (like you would with a java UUID), use this…

select TRIM(CHAR(HEX(GENERATE_UNIQUE()))) from sysibm.sysdummy1;

I should probably also mention that there is the IDENTITY and SEQUENCE, but the GENERATE_UNIQUE() function is the closest you’ll get to a GUID or UUID.

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Weekly Round-Up: 10/13/13 to 10/19/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 10/14
Peter Shankman @PeterShankman says: Stop Tying Your Employee’s Hands – http://markjacobsen.net/l/1875

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Change permissions on files of a specific type in linux

Need to change all *.ksh files to be executable under a directory, but not having luck with a recursive chmod? The issue is you need to combine chmod with a find and xargs like so…

find /home/user -name '*.ksh' | xargs chmod 744

The first piece lists all the files under the path that match *.ksh and passes them to xargs and chmod. If you want to see an example without changing any permissions, just substitute ls -l like so…

find /home/user -name '*.ksh' | xargs ls -l
Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Find the column causing a DB2 import to fail

Ever run DB2 IMPORT and get a super helpful error like…

SQL0407N  Assignment of a NULL value to a NOT NULL column "TBSPACEID=7,
TABLEID=265, COLNO=2" is not allowed.  SQLSTATE=23502

SQL3185W  The previous error occurred while processing data from row "126" of 
the input file.

After you calm down from wanting to smack a DB2 developer in the face, remember the syscat tables and run this SQL to find out the table and column giving you grief…

select  * 
from    syscat.columns c
            inner join syscat.tables t
                on  c.TABSCHEMA = t.TABSCHEMA
                    and c.TABNAME = t.TABNAME
where   c.COLNO = 2 
        and t.TABLEID = 265
        and t.TBSPACEID = 7
Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

How do I send email from the linux command line?

Need to email from your linux command line? Assuming the underlying pieces are configured correctly (run the 1st example to see) here are the basics…

Send a test email

mail -s "Hi there" someone@somewhere.com

Include some body text…

echo "This is some body text" | mail -s "Hi there" someone@somewhere.com

Email the contents of a file to someone…

mail -s "My Subject" someone@somewhere.com < /path/to/your/file.txt

You can find more here

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Weekly Round-Up: 10/6/13 to 10/12/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 10/7
Emily Co on: Ways to Make Passive Income – http://markjacobsen.net/l/1871

Tue 10/8
Krissy Brady @writtenbykrissy on: 12 Habits of Perfectly Organized People – http://markjacobsen.net/l/1872

Wed 10/9
MMM @MrMoneyMustache on: Wealth Advice that Should Be Obvious – http://markjacobsen.net/l/1873

Thu 10/10
iOS 7’s Biggest Annoyances (and How to Fix Them) – http://markjacobsen.net/l/1874

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Weekly Round-Up: 9/29/13 to 10/5/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 9/30
11 Tips to Keep iOS 7 From Destroying Your Battery Life – http://markjacobsen.net/l/1866

Tue 10/1
The Minimalists @JFM reminds us: A Rolex Won’t Give You More Time – http://markjacobsen.net/l/1867

Wed 10/2
What to Do (and Not Do) When You’re in a Car Accident – http://markjacobsen.net/l/1868

Thu 10/3
Craig Dewe @LifestyleOutlaw on: How To Double (Or Triple) Your Current Income – http://markjacobsen.net/l/1869

Fri 10/4
Tom Webster @webby2001 says: Open Plan Offices Make People Unhappy – and I would tend to agree – http://markjacobsen.net/l/1870

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Listening Twice as Fast!

I have a few PodCasts I enjoy and have recently been enjoying our library’s audio book selection. The thing is it always seemed to take so long to get through everything and I don’t like feeling like I’m behind on things. Then, one of my favorite PodCasts (the Lifehacker PodCast) mentioned a feature on most PodCast listening apps to let you listen at 1.5 speed. Sure enough, I opened up my favorite PodCast player and there was the option. Not only did I try it out, I cranked it up to 2x speed and have done the same on my audio book app as well!

If you’re a fan of spoken word content, check it out!

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

How can I be getting a deadlock trying to create a stored proc?

If you’re getting an error similar to the following…

SQL0911N The current transaction has been rolled back because of a deadlock 
or timeout. Reason code "68". LINE NUMBER=171. SQLSTATE=40001

… and you know your tables are all just fine, it may be that someone (likely a DBA) has the SYSCAT.ROUTINES table locked up. Try running this…

SELECT RTRIM(R.ROUTINESCHEMA),RTRIM(R.SPECIFICNAME),RTRIM(R.ROUTINENAME) 
FROM SYSCAT.ROUTINES R 
WHERE R.ROUTINETYPE='P'  
ORDER BY RTRIM(R.ROUTINESCHEMA), RTRIM(R.SPECIFICNAME), RTRIM(R.ROUTINENAME)

…and if that errors, try running “WITH UR”. Assuming the 1st fails and the 2nd does not, have your neighborhood DBA kill any connections that may be causing the lock.

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?

Weekly Round-Up: 9/15/13 to 9/21/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 9/16
Joshua Becker says: We Can Do Better – http://markjacobsen.net/l/1863

Like this? Consider joining my mailing list, or at least using my affiliate link when buying from Amazon 🙂

You or someone you know looking to buy or sell?