If you simply want to find out if it exists, the easiest way is to use the
iSeries Navigator GUI. Expand the tree-structure for your system, expand the
"Database" tab, expand "Libraries", select your library, scroll down to your
table, right click on it, and select properties.
Alternately, you can simply issue a DSPDBR (display database relations)
command from the green-screen command-line.
If you want to operate only in the SQL-Scripts window, you could do this:
CL: DSPDBR FILE(cpsdev/member) OUTPUT(*OUTFILE) OUTFILE(qtemp/mydspdbr);
select * from qtemp/mydspdbr;
OK, one last way: you can query sysindexes in library qsys2.
e.g.
select * from qsys2.sysindexes
where table_schema = 'mySchema';
So, you see there are many ways to accomplish the same task. It all depends
on what you're most comfortable with.
Regards,
Dave
The information contained in this e-mail message and any attachments is confidential and intended only for the addressee(s). If you are not an addressee, you may not copy or disclose the information, or act upon it, and you should delete it entirely from your email system. Please also notify the sender that you received this e-mail in error.
-----Original Message-----
From: Rai Amit
[mailto:db2udbdba-ezmlmshield-x73920472.[Email address protected]
Sent: Wednesday, October 27, 2004 6:57 AM
To: LazyDBA Discussion
Subject: RE: [db2/i-series] drop tables/view/index If exists
you can query syscat.tables and syscat.indexes to verify whether a
table/view/index exists or not.....
-----Original Message-----
From: Justin James
[mailto:db2udbdba-ezmlmshield-x6760920.[Email address protected]
Sent: Wednesday, October 27, 2004 9:54 AM
To: LazyDBA Discussion
Subject: [db2/i-series] drop tables/view/index If exists
How do I detect if an index / view / table already exists in order that I
can drop it and then recreate it without generating any errors?
___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer
DB2 & UDB email list listserv db2-l LazyDBA home page