Thread: Create table syntax
Hi Entered below is the SQL create table syntax: CREATE TABLE lists ( [listid] [int] IDENTITY (1, 1) NOT NULL , [listname] [varchar] (200) NULL , [listcreator] [varchar] (200) NULL , [listdesc] [text] NULL) We need to know that this syntax will work properly in postgresql while creating the table and the autoincrement option for the column(listid). If this syntax is not correct for postgresql, we need the correct syntax. Hoping for a positive response from ur side. Regards Satish Rao
I'm not sure about all the square brackets around field names and types, but I have a hunch they should either be converted to double quotes or left out altogether. Double quotes are needed if any field names have spaces or other non-alpha characters. Instead of IDENTITY (1, 1), use SERIAL, as follows: listid int SERIAL NOT NULL , If you run the statement from the psql command line utility, you'll need a semicolon after the final right paren; it acts like "GO" does in MS SQL Server. Looks like you're converting from SQL Server, no? Check the techdocs section on the postgresql.org website, I think there may be some tools or articles that would also be helpful. Good luck! "satish rao " <csr_del%rediffmail.com@interlock.lexmark.com> on 08/28/2001 02:52:36 AM To: pgsql-general%postgresql.org@interlock.lexmark.com cc: (bcc: Wesley Sheldahl/Lex/Lexmark) Subject: [GENERAL] Create table syntax Hi Entered below is the SQL create table syntax: CREATE TABLE lists ( [listid] [int] IDENTITY (1, 1) NOT NULL , [listname] [varchar] (200) NULL , [listcreator] [varchar] (200) NULL , [listdesc] [text] NULL) We need to know that this syntax will work properly in postgresql while creating the table and the autoincrement option for the column(listid). If this syntax is not correct for postgresql, we need the correct syntax. Hoping for a positive response from ur side. Regards Satish Rao ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
On Tue, Aug 28, 2001 at 06:52:36AM -0000, satish rao wrote: > Hi > > Entered below is the SQL create table syntax: > > CREATE TABLE lists ( > [listid] [int] IDENTITY (1, 1) NOT NULL , > [listname] [varchar] (200) NULL , > [listcreator] [varchar] (200) NULL , > [listdesc] [text] NULL) > > > We need to know that this syntax will work properly in > postgresql while creating the table and the > autoincrement option for the column(listid). If this > syntax is not correct for postgresql, we need the > correct syntax. Have you looked at the documentation? There is plenty on the website and psql has a brief summary when you type \h CREATE TABLE Unfortunatly my postgres server isn't booting right now (version mismatch) so I can't paste the result here... -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > It would be nice if someone came up with a certification system that > actually separated those who can barely regurgitate what they crammed over > the last few weeks from those who command secret ninja networking powers.