Yes, the idea for this script was blatantly ripped off from 4 guysfromrolla... but that script didn't do exactly what I needed, so I took that concept, and changed it for what I needed...
All you've got to do, is provide the primary key of the table that you'll be selecting from, and the table name, the rest is generated for you.
Check it out here: