Subject | Re: [firebird-support] Design issue |
---|---|
Author | Milan Babuskov |
Post date | 2003-08-19T13:35:24Z |
Juan Pedro López Sáez wrote:
Create table that contains basic data about all YOUR clients, for example:
create table My_Client
(
id integer not null,
name char(30),
primary key (id)
);
In your existing table of clients, add a field which will describe which
client belong to which of your clients:
alter table clients add my_client_id integer;
alter table clients add constraing foreign key (my_client_id) references
my_client(id);
This way you can handle all with 2 tables and you don't have to add new
tables each time you have a new client...
HTH
P.S. I wrote all this off the top of my head, so check syntax before
trying it...
--
Milan Babuskov
http://fbexport.sourceforge.net
http://njam.sourceforge.net
> I've got a table, named CLIENTS, with a primary key field, K_CLIENT.Ok, here's the idea.
> Every time I add a new client to my database I insert a new record to
> this table. The K_CLIENT field is incremented by means of a generator.
>
> After that I have to create this new client's tables. For this purpose I
> use the K_CLIENT value as the suffix for the tables' names, as I
> explained before. So, if the K_CLIENT value for the created new client
> is 14, I will create the table named GROUPS_14 for this client.
Create table that contains basic data about all YOUR clients, for example:
create table My_Client
(
id integer not null,
name char(30),
primary key (id)
);
In your existing table of clients, add a field which will describe which
client belong to which of your clients:
alter table clients add my_client_id integer;
alter table clients add constraing foreign key (my_client_id) references
my_client(id);
This way you can handle all with 2 tables and you don't have to add new
tables each time you have a new client...
HTH
P.S. I wrote all this off the top of my head, so check syntax before
trying it...
--
Milan Babuskov
http://fbexport.sourceforge.net
http://njam.sourceforge.net