Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Create Table Pr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3528 of 3799
Post > Topic >>

Create Table Problem

by shavonne.marietta@[EMAIL PROTECTED] ("Shavonne Marietta Wijesinghe") Jun 13, 2008 at 02:05 PM

This is a multi-part message in MIME format.

------=_NextPart_000_00A3_01C8CD5E.7B279270
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello

I'm having some trouble checking if a table exist before i create it.=20

Example:

SELECT * FROM distributors

IF (table not found) THEN
    CREATE TABLE distributors (
        did     integer,
        name    varchar(40),
        UNIQUE(name)
    );
END IF

If i have a table like the above how can i identify if the table exists =
or not?

Thank You.

Shavonne Wijesinghe

------=_NextPart_000_00A3_01C8CD5E.7B279270
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial>Hello</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>I'm having some trouble checking if a table =
exist before i=20
create it. </FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>Example:</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New">SELECT * FROM distributors</FONT></DIV>
<DIV><FONT face=3D"Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"Courier New">IF (table not found) THEN</FONT></DIV>
<DIV><FONT face=3D"Courier New">&nbsp;&nbsp;&nbsp; CREATE TABLE =
distributors=20
(<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; did&nbsp;&nbsp;&nbsp;&nbsp;=20
integer,<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name&nbsp;&nbsp;&nbsp; =

varchar(40),<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
UNIQUE(name)<BR>&nbsp;&nbsp;&nbsp; );</FONT></DIV>
<DIV><FONT face=3D"Courier New">END IF</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>If i have a table like the above how can i =
identify if the=20
table exists or not?</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>Thank You.</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><B>Shavonne=20
Wijesinghe</B><BR></SPAN></DIV></BODY></HTML>

------=_NextPart_000_00A3_01C8CD5E.7B279270--
 




 2 Posts in Topic:
Create Table Problem
shavonne.marietta@[EMAIL   2008-06-13 14:05:05 
Re: Create Table Problem
yazicivo@[EMAIL PROTECTED  2008-06-13 15:31:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:38:16 CST 2008.