Adding multiple column in alter statement?

Started by Ashish Karalkarabout 19 years ago2 messagesgeneral
Jump to latest
#1Ashish Karalkar
ashish_postgre@yahoo.co.in

Hello All,
I want to add multiple column to a table using single alter statemet,
someting like this:

alter table admin_session add column accounting_session varchar(1) not null default '0',accounting_active varchar(1),acc_start_date date,acc_end_date date;

is there any way?

Thanks in Advance

With Regards
Ashish...

---------------------------------
Here�s a new way to find what you're looking for - Yahoo! Answers

#2A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Ashish Karalkar (#1)
Re: Adding multiple column in alter statement?

am Thu, dem 05.04.2007, um 6:58:01 +0100 mailte Ashish Karalkar folgendes:

Hello All,
I want to add multiple column to a table using single alter statemet,
someting like this:

alter table admin_session add column accounting_session varchar(1) not null
default '0',accounting_active varchar(1),acc_start_date date,acc_end_date date;

is there any way?

Yes, read the doc ;-)

test=# \d bla
Table "public.bla"
Column | Type | Modifiers
--------+---------+-----------
id | integer |

test=# alter table bla add column name1 text, add column name2 text, add column name3 text;
ALTER TABLE
test=*# \d bla
Table "public.bla"
Column | Type | Modifiers
--------+---------+-----------
id | integer |
name1 | text |
name2 | text |
name3 | text |

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net