|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL statement to check if a table exists
Hi,
I want to know if there is a sql statement to check if a table exists in database. I am using ms acess. I used [CODE} statement.executeQuery("select count(1) from MSysObjects where name='abc' and type=1"); [CODE] When I execute this in database it executes fine, but when i execute thus from java class I get java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; no read permission on 'MSysObjects'. Is there another way I can check if a table exits? Thanks |
|
#2
|
||||
|
||||
|
I doubt if checking for existence of the table is going to help. The error message indicates a permission problem, you should get permissions on the table.
__________________
|
|
#3
|
|||
|
|||
|
if object_id('database..table1') is not null
This may get around your permission issue with sysobjects Hope this helps -gdrav |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > SQL statement to check if a table exists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|