Thread: help!

help!

From
"John Geng"
Date:
<p>how to migrate sql from MS sql server to postgresql?<p>i'd like to tranfer sql schema from MS server<br
/>Example:<br/>*******************1*********************************<br />if exists (select * from sysobjects <br
/>whereid = object_id(N'[admin].[test]') and <br />OBJECTPROPERTY(id, N'IsUserTable') = 1)<br />drop table
[admin].[test]<br />go<br />*******************2*********************************<br />CREATE TABLE [admin].[test] (<br
/>[test_name][char] (50) NOT NULL ,<br />[test_value] [int] NOT NULL <br />)<br /><br />   i can only realize part 2. i
don'tknow how to realize part 1.in other words,<p>i want to know how to check if a table exist in
postgresql<p>*******************2*********************************<br/>  create table test(<br />   test_name char (50)
notnull,<br />   test_value int not null<br />  )<p><br />thanks for any advice!!<br /> 

Re: help!

From
Horst Herb
Date:
On Wed, 16 Oct 2002 19:15, John Geng wrote:
> how to migrate sql from MS sql server to postgresql?
> i'd like to tranfer sql schema from MS server
> Example:
> *******************1*********************************
> if exists (select * from sysobjects
> where id = object_id(N'[admin].[test]') and
> OBJECTPROPERTY(id, N'IsUserTable') = 1)
> drop table [admin].[test]

if exists (select * from pg_tables where tablename = '<your table name goes 
here')

might be what you are looking for

Horst