Best Regards, Guy Przytula
Database Software Consultant
Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
Information Server Datastage Certified http://www.infocura.be
In DB2 all the table names and column-names are assumed to be in UPPERCASE , so when the column-names or table-names are in MixedCase (like yours) you must always surround them with double-quotes everywhere they appear in SQL.
Wise developers/designers avoid mixed case table-names and avoid mixed-case column-names, but sometimes popular applications use MixedCase so you always need to use double-quotes to tell DB2 not to force to capitals.
select * from MC."Agent Details" WHERE "AgencyName" like 'a%'
The real column name you have to specify depends on how exactly this table was created.
There are some rules:
If the table was created like this: create table "Agent Details" (agencyno int, AgencyName varchar(10))
then DB2 converts the 'AgencyName' name to upper case and you can use this name in your queries in any case: AgencyName, agencyname, AGENCYNAME, AgEnCyNaMe. DB2 converts such an object's name in your query to uppercase as well.
But if you want to name your table or column CASE SENSITIVELY for some reason, then DB2 stores this name case sensitively and YOU HAVE TO reference this object exactly as it was specified during its creation. To do it you have to surround this name by double quotes.
So, if you created your table like this: create table MC."Agent Details" (agencyno int, "AgencyName" varchar(10))
then you have to query this table like this: select * from MC."Agent Details" WHERE "AgencyName" like 'a%'