Board index » delphi » reassign domain to column definition of existing table

reassign domain to column definition of existing table

Dear all,

I do the following to reassign domain to column definition of existing
table:

UPDATE RDB$RELATION_FIELDS SET RDB$FIELD_SOURCE = [domain name] WHERE
RDB$FIELD_NAME = [column name] AND RDB$RELATION_NAME = [table name];

I wish to know if I has miss something, thank you, anyone could help?

by the way, how to add NOT NULL in domain, is it eqvivalent to checking it
not null in domain, if yes, should I use IS NULL to check it?

Thank you in advance.

 

Re:reassign domain to column definition of existing table


Why don't you do

ALTER TABLE tablename
ALTER columnname TYPE domainname

--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool
for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool
for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users
object."

"NEWBIES" <newb...@netvigator.com> wrote
in message
news:3dca407b$1@newsgroups.borland.com..
.

Quote
> Dear all,

> I do the following to reassign domain

to column definition of existing
Quote
> table:

> UPDATE RDB$RELATION_FIELDS SET

RDB$FIELD_SOURCE = [domain name] WHERE
Quote
> RDB$FIELD_NAME = [column name] AND

RDB$RELATION_NAME = [table name];
Quote

> I wish to know if I has miss

something, thank you, anyone could help?
Quote

> by the way, how to add NOT NULL in

domain, is it eqvivalent to checking it
Quote
> not null in domain, if yes, should I

use IS NULL to check it?
Quote

> Thank you in advance.

Re:reassign domain to column definition of existing table


Hi,

Quote
> Ha Tonies....simply because I don't

know I can do in this way, thank you
Quote
> very
> much....as at the beginning I don't

understand the SQLreference in
Quote
> documentation which reads:
> ALTER TABLE table <operation> [,
<operation> ?K];

> Now look back, I understand that

la...thank you again...too stupid..^0^

:)

Ah well, you just have to get used to
reading it...

Quote
> By the way, if inside procedure I

can't declare variable type as domain,
not
Quote
> even pass-in parameter.
> I thought domain is very dynamic, I

don't know that when:

Quote

> create procedure a (passIn1
[domainName])
> ....

Right - this isn't possible. Plain and
simple.

Quote
> will gives me error.....any

suggestion?

The tool that I wrote ( InterBase
Workbench - see www.upscene.com for
details)
does allow you to select a certain
domain as input/output parameters. This
way,
you can easily select the same datatype
as your domains. However, it doesn't
keep
track of changes -- so if you change the
domain, your procedure parameter won't
be changed (datatype).

--

With regards,

Martijn Tonies
InterBase Workbench - the developer tool
for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool
for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users
object."

Re:reassign domain to column definition of existing table


Updating the system tables can corrupt your database. The safe way is
Martjin's way.

On Thu, 7 Nov 2002 18:29:28 +0800, "NEWBIES" <newb...@netvigator.com>
wrote:

Quote
>Dear all,

>I do the following to reassign domain to column definition of existing
>table:

>UPDATE RDB$RELATION_FIELDS SET RDB$FIELD_SOURCE = [domain name] WHERE
>RDB$FIELD_NAME = [column name] AND RDB$RELATION_NAME = [table name];

>I wish to know if I has miss something, thank you, anyone could help?

>by the way, how to add NOT NULL in domain, is it eqvivalent to checking it
>not null in domain, if yes, should I use IS NULL to check it?

>Thank you in advance.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)

Re:reassign domain to column definition of existing table


Hello, active time...

Quote
> :)

> Ah well, you just have to get used to
> reading it...

I agree with you, I 've better learn to understand it.....it is very risky
to access system table without knowing well about system table relationship,
this time is luckily that the system tables involve is not much -
rdb$relation_fields, rdb$fields, rdb$types for column definition....  I
think there is a driver inside me to re-read the whole thing all over again.

Quote
> > By the way, if inside procedure I
>> can't declare variable type as domain,
> Right - this isn't possible. Plain and
> simple.

Thank you, now I get a clear answer. ^_-

Quote
> > will gives me error.....any
> suggestion?

> The tool that I wrote ( InterBase
> Workbench - see www.upscene.com for
> details)
> does allow you to select a certain
> domain as input/output parameters. This
> way,
> you can easily select the same datatype
> as your domains. However, it doesn't
> keep
> track of changes -- so if you change the
> domain, your procedure parameter won't
> be changed (datatype).

Well, it is a good suggestion but if it don't charge me, then it will be
very much better, do you agree?

Thank you for your nice reply.
CWT

Re:reassign domain to column definition of existing table


Quote
> Updating the system tables can corrupt your database. The safe way is
> Martjin's way.

Yes, I understand that it is risky when I really don't know the relationship
between system tables, updating is manually is no good ideal, but I just
don't know there's such a way beforehand......ha ha.....just don't
understand SQL Reference and don't know how to seek for help, so doing
something stupid.

Thank you Bill.

Other Threads