I'm trying to check if a table exist on my IBM As400 database.
I'm using Vb.net to create an application, which runs sql statements and sends them via an ODBC connection to the AS400.
99% of my app works, but I want to be able to check if a table exist before running any SQL's.
I've seen some examples on the net and in the forums such as the following:
--===== If the test table already exists, drop it IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL DROP TABLE #mytable
However, I'm not sure if my OBJECT_ID is not set properly or IBM doesn't like some of the commands being sent to it.
For instance in my create table statement I do the following:
query = "CREATE TABLE " & tmptable _
& " (PRPROP CHAR(30) CCSID 37 DEFAULT NULL, " _
Private Sub ODBC_SQL()
ODBC_DataAdapter = New Odbc.OdbcDataAdapter(ODBC_Command)
ODBC_DataAdapter.SelectCommand = New System.Data.Odbc.OdbcCommand(query, ODBC_connect)
My create table statement works fine, and if I add a "DROP" table statement it works too. However, I basically want to check if the table exist first before I create the table so I won't get any error messages.
Any help is appreciated.