fhg
Volume 8, Number 9 -- March 5, 2008

Don't Let SQL Name Your Baby, Take 2

Published: March 5, 2008

Hey, Ted:

Don't Let SQL Name Your Baby gave some good advice on tackling the problems created by column names longer than 10 characters. Table names of more than 10 characters can also cause problems, especially if you need to add the same table on multiple systems. Plus, if you want to do updates in an RPG program, it's nice to have a record format name different from the table name.

--Tim

Tim points out another discrepancy between the System i's QSYS.LIB file system and relational databases that run on other systems. Using SQL, you can create a table with a very long name, but object names can't be more than 10 characters long. Here's how you might create a table (physical file) with a very long name.

create table tholt/AVeryLongTableName
   (key dec(3), data char(10))

In order for you to access that file from commands like Copy File (CPYF) and Run Query (RUNQRY), the system generates a name, which in this case is something like AVERY00001. If you don't like that name, you can use CL's Rename Object (RNMOBJ) command to rename the physical file.

rnmobj obj(tholt/avery00001) objtype(*file) newobj(averylong)

Or you can use SQL's RENAME command.

rename table avery00001 to system name averylong

In either case, the new i5/OS-compliant file name is AVERYLONG.

Tim has what I consider to be a better method. First, create the table using a desired record format name.

create table rtesttbl etc. etc. etc.

Then rename it.

rename rtesttbl to testing_long_sql_names
for system name testtblf

After this operation, physical file TESTTBLF, with record format RTESTTBL, has a long SQL name of TESTING_LONG_SQL_NAMES.

--Ted


RELATED STORY

Don't Let SQL Name Your Baby



                     Post this story to del.icio.us
               Post this story to Digg
    Post this story to Slashdot


Sponsored By
SPSS

Put Your Data Into Sharper Focus

Gain a deeper understanding of your business
without getting lost in the data.

Dashboards help you quickly analyze trends and changes,
instantly drill down to critical details,
and see multiple views of your business at a glance.

Learn more in a complimentary webcast from SPSS
on exploring System i5 data with dashboards.

Watch now from your desktop.


Senior Technical Editor: Ted Holt
Technical Editors: Howard Arner, Joe Hertvik, Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Brian Kelly, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.

Sponsored Links

COMMON:  Join us at the annual 2008 conference, March 30 - April 3, in Nashville, Tennessee
ARCAD Software:  Dynamic, world-class ALM on and around the System i
New Generation Software:  Look at NGS-IQ before replacing Query/400


 

IT Jungle Store Top Book Picks

Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
Getting Started with PHP for i5/OS: List Price, $59.95
The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
The System i Pocket RPG & RPG IV Guide: List Price, $69.95
The iSeries Pocket Database Guide: List Price, $59.00
The iSeries Pocket Developers' Guide: List Price, $59.00
The iSeries Pocket SQL Guide: List Price, $59.00
The iSeries Pocket Query Guide: List Price, $49.00
The iSeries Pocket WebFacing Primer: List Price, $39.00
Migrating to WebSphere Express for iSeries: List Price, $49.00
iSeries Express Web Implementer's Guide: List Price, $59.00
Getting Started with WebSphere Development Studio for iSeries: List Price, $79.95
Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
Getting Started with WebSphere Express for iSeries: List Price, $49.00
WebFacing Application Design and Development Guide: List Price, $55.00
Can the AS/400 Survive IBM?: List Price, $49.00
The All-Everything Machine: List Price, $29.95
Chip Wars: List Price, $29.95


 
The Four Hundred
Q&A with IBM's Mark Shearer: Still Mister System i

Linux and Windows Server Sales Outpace the Market in Q4

Infinite Software Partners with HP, Acquires Altos Technology Group

Mad Dog 21/21: Plane's Peeking

MetaRAM Quadruples DDR2 Memory Capacity in Servers

The Linux Beacon
Linux and Windows Server Sales Outpace the Market in Q4

Novell Swings to a Modest Profit in Fiscal Q1

MetaRAM Quadruples DDR2 Memory Capacity in Servers

As I See It: Change in Plan

Microsoft Promises To Be Less Secretive, More Open

Four Hundred Stuff
Centerfield Adds More Smarts to Database Performance Suite

Aura Equipments Pushes i5/OS-Excel Integration

Innovatum Adds Biometric Authentication to Improve Compliance 'Auditability'

Surf's Up for Web-Based Organized Crime, IBM X-Force Says

WorksRight Gains USPS Certification, Launches New Product

Big Iron
IBM Launches 64-Way z10 Enterprise Class Mainframe Behemoth

Top Mainframe Stories From Around the Web

Chats, Webinars, Seminars, Shows, and Other Happenings

System i PTF Guide
March 1, 2008: Volume 10, Number 9

February 23, 2008: Volume 10, Number 8

February 16, 2008: Volume 10, Number 7

February 9, 2008: Volume 10, Number 6

February 2, 2008: Volume 10, Number 5

January 26, 2008: Volume 10, Number 4

The Windows Observer
Microsoft Promises To Be Less Secretive, More Open

Welcome to Legacy Status, Windows Server

'Centro' and 'Cougar' Become Windows Server Essentials

Microsoft Presses Forward with Yahoo, as Shareholder Lawsuits Mount

Today is the Big 'Heroes Happen Here' Launch Event

The Unix Guardian
Q&A with HP's Brian Cox: Tukwila Itaniums and Hockey Pucks

Gartner Gives Annual Report Cards to Server Makers

IDC Tweaks Global IT Spending Estimates Downward for 2008

As I See It: Change in Plan

Welcome to Legacy Status, Windows Server

Four Hundred Monitor
Four Hundred Monitor's
Full iSeries Events Calendar

THIS ISSUE SPONSORED BY:

Help/Systems
SPSS
Guild Companies


Printer Friendly Version


TABLE OF CONTENTS
Performance Advice from a Mysterious Friend

Don't Let SQL Name Your Baby, Take 2

Admin Alert: When System i Ethernet Cards Stop Broadcasting

Four Hundred Guru

BACK ISSUES

From the IT Jungle Forums
Data Type *DEC in MSGF

How to identify when the OS upgrade was performed ???

FTP in arrival sequence

S36 environment problem

QSH won't write in batch!





 
Subscription Information:
You can unsubscribe, change your email address, or sign up for any of IT Jungle's free e-newsletters through our Web site at http://www.itjungle.com/sub/subscribe.html.

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc., 50 Park Terrace East, Suite 8F, New York, NY 10034

Privacy Statement