DB2 Get Current MAX value for all IDENTITY Columns

If you’ve ever dealt with DB2 IDENTITY columns chances are you may have wanted to know what the currently assigned max value is for all of the IDENTITY columns in the DB. If so, you can use the following SQL to generate the SQL that will give you your answer. Hope it helps!

select 'select '''||trim(t.tabname)||''', '''||trim(c.colname)||''', max('||trim(c.colname)||') from '||trim(t.tabschema)||'.'||trim(t.tabname)||' for read only with ur;'
from syscat.sequences s join syscat.tables t on
(s.seqschema=t.tabschema and s.create_time=t.create_time)
join syscat.columns c on
(t.tabschema=c.tabschema and t.tabname=c.tabname)
where s.seqname like 'SQL%'
and c.identity='Y'
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: 1/5/14 to 1/11/14

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

Mon 1/6
Daniel Wallen @TheWallenWay on 20 Simple But Powerful Changes You Can Make To Simplify Your Life – http://mjg2.net/l/1905

Tue 1/7
This One Minute Video May Help You Save Someone’s Life – http://mjg2.net/l/1906

Wed 1/8
10 Health Myths That Just Won’t Die, Debunked by Science – http://mjg2.net/l/1907

Thu 1/9
Don’t Always Aim to Meet Unrealistic Deadlines – http://mjg2.net/l/1908

Fri 1/10
LPT: Open letter to car drivers from a part-time truck driver : LifeProTips – http://mjg2.net/l/1909

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?

Now Reading Mini-Missions

Reading Courtney Carver’s latest book: Mini-Missions for Simplicity

Interesting so far. Anyone else out there read it? Thoughts?

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: 12/29/13 to 1/4/14

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

Mon 12/30
Marla Walters @cruelironing on 10 Rules of Etiquette Everyone Should Know (and Follow!) – http://mjg2.net/l/1899

Tue 12/31
Kiyah Duffey @KiyahDuffey: a beautiful body – http://mjg2.net/l/1902

Thu 1/2
Joshua Fields Millburn @JFM on The Success Template – http://mjg2.net/l/1903

Fri 1/3
Lynn Truong @lynntruong says 68% of Shoppers Are Getting Ripped Off – http://mjg2.net/l/1904

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?

Saving $1000 on Auto Insurance

We recently received our auto insurance bill in the mail, and for once I decided to “just see” how much of a difference it could make going with a different company. At over $2k for the year (keep in mind MI is a no-fault state) I was hoping to knock a couple hundred bucks off. I started off as I would imagine anyone would do these days and took right to the internet. First stop… State Farm. After entering the data they wanted I waited eagerly and… more expensive. I almost stopped figuring “everyone is going to be the same”.

Still something pushed me onward even with children who needed things wining in the background. Next up I hit Progressive. This time I got a little encouragement with a quote around $700 every six months. I played around with the numbers and got it down to around $550 every six. We were talking some serious cash now. How could roughly the same benefit cost nearly 1/2 what I was paying??

Figuring it didn’t hurt to keep looking I decided to also give Geico a try. This time I was shocked to get a quote even lower! After looking over the numbers I chose to actually increase some of the limits and still kept it around $550 every 6 months.

In the end I chose Geico because for the same rate as Progressive I got more coverage, and still wound up paying nearly 1/2 what I was with AAA. When calling in to setup the coverage I was told that the primary discount was for an excellent credit rating, so for anyone reading this, make sure you’re paying your bills on time, in-full every month.

For those who want a breakdown of the actual coverage numbers, here they are…

Coverage AAA Progressive Geico
BI Liability $100k/$300k $100k/$300k $300k/$500k
Property Damage Liability (PD) $50k $100k $100k
Limited property Damage Liability “Included” $1k $1k
Property Protection (PP) “Included” $1M $1M
Uninsured Motorist BI $20k/$40k $100k/$300k $300k/$500k
Deductible/car $550 basic $500 comp/$1k collission broad form $500 broad form

The moral of the story? Go check your auto insurance coverage and rates then go comparison shopping. No guarantees you’ll see the savings I did, but it just may save you hundreds if not thousands of dollars a year.

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: 12/22/13 to 12/28/13

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

Mon 12/23
The Minimalist Mom @racheljonat reminds us: You Can Stop Shopping Now – http://mjg2.net/l/1901

Tue 12/24
Adam Penenberg @Penenberg challenged hackers to investigate him and what they found out is chilling – http://mjg2.net/l/1896

Thu 12/26
Sean Blanda @SeanBlanda gives 10 Tips for an Awesome Coffee Meeting – http://mjg2.net/l/1897

Fri 12/27
Jegede Abayomi @abayomi_jegede tells us about 10 Habits of The Richest People in the World – http://mjg2.net/l/1898

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: 12/15/13 to 12/21/13

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

Mon 12/16
Amy Morin @AmyMorinLCSW on 8 Scientific Secrets Of A Happy Marriage – http://mjg2.net/l/1890

Tue 12/17
Peter Shankman @petershankman On Entitlement, Regardless Of Your Generation <- this. So much this. - http://mjg2.net/l/1892

Wed 12/18
Why 9 to 5 is a Joke (And How to Deal) – http://mjg2.net/l/1893

Thu 12/19
MMM @MrMoneyMustache tells you how to Get Rich With The Position of Strength – http://mjg2.net/l/1894

Fri 12/20
How to Plant Ideas in Someone’s Mind – http://mjg2.net/l/1895

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: 12/8/13 to 12/14/13

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

Mon 12/9
Mark Panay @redeye on 13 Productivity Tips from People Getting Stuff Done – http://mjg2.net/l/1887

Tue 12/10
MMM @MrMoneyMustache says we’re Predictably Irrational – http://mjg2.net/l/1888

Thu 12/12
As a father of girls this makes me sad: How the Media Failed Women in 2013 – http://mjg2.net/l/1900

Fri 12/13
jlcollinsnh: Case Study #4: Using the 4% rule and asset allocations – http://mjg2.net/l/1889

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?

DB2: How to find records with non-printable characters (SQLSTATE 01517)

If you run a select statement and get the following error…

"SQLSTATE 01517: A character that could not be converted was 
replaced with a substitute character."

… you can use the TRANSLATE function to strip away printable chars, and compare that to a zero length string like so…

SELECT * 
FROM XX.TBL 
WHERE TRANSLATE(UPPER(FIELD_X),'','ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=+/\{}[];:.,<>? ') <> '' 
FOR READ ONLY WITH UR;
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: 12/1/13 to 12/7/13

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

Mon 12/2
Joshua Fields Millburn @JFM on Five Steps Toward a More Meaningful Holiday Season – http://mjg2.net/l/1891

Tue 12/3
Brianna Wiest @briaeliza – 18 Things Everyone Should Start Making Time For Again – I agree with some of them. – http://mjg2.net/l/1883

Wed 12/4
Leo @zen_habis on The Necessary Art of Subtraction – http://mjg2.net/l/1884

Thu 12/5
Michelle Schroeder @senseofcents on 10 Things Successful People Do Differently To Reach Their Dreams – http://mjg2.net/l/1885

Fri 12/6
Kimberly Weisul @weisul on How I Became the Kind of Person Who Can Work a Room – http://mjg2.net/l/1886

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?