View Full Version : SQL Command to check table existence
01-01-1995, 02:00 AM
Is there a direct SQL command to check the existence of a table without using CL program. Like in MS SQL, they have SYSOBJECTS to check existence of a table. Thank you very much for any help I could get.
06-12-2000, 05:22 AM
Emer, You could read the system catalog to check to see whether a table exists. The table you need to use to check for a file's existance is systables. Something like select count(*) from systables where table_name = 'MYTABLE' should work. There are other system catalog files containing fields, views, indexes, procedures, etc. David Morris
08-10-2000, 12:20 PM
select count(*) from systables where table_name = '<tablename>' This will give you a numeric response of 0 or greater than 0 if the table exists. Remember that systables are in lib qsys2. Hope this helps!
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.