Re: CREATE TABLE IF NOT EXIST

Поиск
Список
Период
Сортировка
От Obe, Regina
Тема Re: CREATE TABLE IF NOT EXIST
Дата
Msg-id 53F9CF533E1AA14EA1F8C5C08ABC08D20316E557@ZDND.DND.boston.cob
обсуждение исходный текст
Ответ на CREATE TABLE IF NOT EXIST  ("Mike Gagnon" <mike.gagnon@bellnet.ca>)
Список pgsql-odbc
IF NOT EXISTS(SELECT tablename FROM pg_catalog.pg_tables WHERE tablename = 'mytable')
 
....
 
 
IF NOT EXISTS(SELECT table_name FROM information_schema.tables where table_name = 'mytable')
 
Maybe the problem you are having is a permissions problem though.  Are you using the same account in psql as you are in ODBC?
 
Hope that helps,
Regina


From: pgsql-odbc-owner@postgresql.org [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Mike Gagnon
Sent: Friday, January 25, 2008 9:09 AM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] CREATE TABLE IF NOT EXIST

Hi Postgres Experts,
 
I'm trying to create tables (if they don't exist) through the ODBC driver.  I've tried the following:
 
SELECT relname FROM pg_class  WHERE relname = 'mytable';
 
This works from the psql command line program when logged into my database, but not when connected to my database over ODBC ( I get SQL_NO_DATA back from SQLFetch)
 
Any ideas?  Are there other ways to find out if a table exists?
 
Many thanks,
Mike


The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.


Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper.

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Lathrop_Steve@emc.com
Дата:
Сообщение: Building ODBC driver issue
Следующее
От: "Hiroshi Saito"
Дата:
Сообщение: Re: Building ODBC driver issue