Fwd: Require assistance

2 views
Skip to first unread message

Prakash Krishnan

unread,
Nov 21, 2009, 7:25:12 AM11/21/09
to h2-da...@googlegroups.com


---------- Forwarded message ----------
From: Prakash Krishnan <prakas...@gmail.com>
Date: Sat, Nov 21, 2009 at 4:02 AM
Subject: Require assistance
To: thomas.tom.muel...@gmail.com


Dear Thomas,

We in our organization have decided to migrate from Derby Data base to H2 data base. I would like to get some assistance from you if you are free.

The Problem that i face as of now.
I want to create a table with auto increment of primary key how to define the same.i.e. in dery we create a table like below.
create table lgr(lgr_code int not null primary key generated always as identity(start with 1, increment  by 1),lgr_user_code varchar(13) not null unique , lgr_name varchar(50) not null unique,lgr_description varchar(125) default null,lgr_grp_code int not null, status char(1) constraint status_type check(status in ('C','D')) default 'D',opening_balance double default 0.00,active char(1) not null constraint acct_check check(active in('Y','N')) default 'Y',lgr_grp_head_code char(3) not null constraint lgrgrouphead check(lgr_grp_head_code in ('CSH','PUR','DIN','DT','IIN','IEC','DTT','TCR','DEX','PLA','BNK','CPA','DEP','LNS','PVS','TAS','SDL','INV','UDL','GNR','OCL','ADV','MIS','IAS')) ,transaction_dr double default 0.00,transaction_cr double default 0.00,transaction_balance double default 0.00)

now could u assist me in how to create the above table in H2


Thanking you

Regds - K.Prakash

           

--
Keep in Touch
Prakash
prakas...@gmail.com



--
Keep in Touch
Prakash
prakas...@gmail.com

Thomas Mueller

unread,
Nov 24, 2009, 3:09:01 PM11/24/09
to h2-da...@googlegroups.com
Hi,

Try:
create table lgr(lgr_code int not null identity(1, 1) primary
key,lgr_user_code varchar(13) not null unique , lgr_name varchar(50)
not null unique,lgr_description varchar(125) default null,lgr_grp_code
int not null, status char(1) default 'D' constraint status_type
check(status in ('C','D')), opening_balance double default 0.00,active
char(1) not null default 'Y' constraint acct_check check(active
in('Y','N')), lgr_grp_head_code char(3) not null constraint
lgrgrouphead check(lgr_grp_head_code in
('CSH','PUR','DIN','DT','IIN','IEC','DTT','TCR','DEX','PLA','BNK','CPA','DEP','LNS','PVS','TAS','SDL','INV','UDL','GNR','OCL','ADV','MIS','IAS'))
,transaction_dr double default 0.00,transaction_cr double default
0.00,transaction_balance double default 0.00)

See also http://www.h2database.com/html/grammar.html#create_table

P.S. You didn't send the email to me, you sent it the the non-existing
addresses with the dots (thomas.tom.muel...@gmail.com). The dots are
used by Google to protect from spam.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages