Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Store domain data values with the table definition

4 views
Skip to first unread message

Jim Diaz

unread,
Oct 30, 2009, 4:11:59 PM10/30/09
to
Sort of like procedure format but a little more....

Thanks again,

Jim


Breck Carter [TeamSybase]

unread,
Oct 31, 2009, 8:54:56 AM10/31/09
to
Please explain further, with an example plus reasons you want this.

Thanks!

Breck

On 30 Oct 2009 12:11:59 -0800, "Jim Diaz"
<nos...@emprisecorporation.com> wrote:

--
Breck Carter http://sqlanywhere.blogspot.com/

RisingRoad SQL Anywhere and MobiLink Professional Services
breck....@risingroad.com

Jim Diaz

unread,
Dec 4, 2009, 7:40:53 PM12/4/09
to
Sorry I took so long to reply.

I'm thinking of entities such as PersonsGenders with a single attribute
(Gender) and domain values of 'Male' and 'Female' if we could store these
values with the table definition then when we unload the database without
data to get a "Blank" or "Empty" database these values will be output with
the Schema. This of course should be extended to multiple column tables as
well.

One way to do this might be to allow us to store certain SQL which would be
output after the CREATE TABLE statements in the schema produced during an
unload. Or perhaps there is another command which would produce a schema
output with this extra SQL. This would allow a user to store the domain
values as sql script such as insert into aaa.zzzz(a,b,c) values(1,2,3);

Of course this could be extended to other than domain data but I can't think
of anything else that might be needed.

Regards,

Jim


"Breck Carter [TeamSybase]" <NOSPAM__br...@gmail.com> wrote in
message news:3rcoe5ltoqd681sop...@4ax.com...

Breck Carter [TeamSybase]

unread,
Dec 6, 2009, 9:39:53 AM12/6/09
to
I'm guessing the CHECK constraint isn't what you're looking for, or
the CREATE DOMAIN statement, but just in case...

CREATE DOMAIN GenderDomain
VARCHAR ( 100 )
NOT NULL
CHECK ( @column IN ( 'Male', 'Female' ) );

CREATE TABLE PersonsGenders (
pkey INTEGER NOT NULL PRIMARY KEY,
gender GenderDomain );

INSERT PersonsGenders VALUES ( 1, 'Male' );
INSERT PersonsGenders VALUES ( 2, 'Female' );
COMMIT;

SELECT * FROM PersonsGenders;

INSERT PersonsGenders VALUES ( 3, 'xxx' ); -- SQLCODE -209 Invalid
value


On 4 Dec 2009 16:40:53 -0800, "Jim Diaz"
<nos...@emprisecorporation.com> wrote:

--
Breck Carter - Blog: http://sqlanywhere.blogspot.com/

SQLA questions and answers: http://sqla.stackexchange.com

RisingRoad helps SQL Anywhere developers make better databases
http://www.risingroad.com/
Breck.Carter at gmail

0 new messages