Tuesday, March 20, 2012

Referencing another table in MS_SQL?

Hello everyone,
We would like to have the user_ID field in the security table reference the
email field in the Cusomer table. Basically, I would like instant updates
of security login information when the email is changed/added in the
customer table. I would prefer not to have periodic updates/sync. The
preferred method would reference the email field rather than update from the
email field.
Example of use: When an end user modifies their personal info (email field
in the customer table), the login will instantly be set/updated in the
user_ID field in the security table.
Any help is appreciated. Thanks."Kevin" <kevin_aoki@.NOSPAMhotmail.com123> wrote in message
news:9Oyhd.80$2N2.46980@.news.uswest.net...
> Hello everyone,
> We would like to have the user_ID field in the security table reference
the
> email field in the Cusomer table. Basically, I would like instant updates
> of security login information when the email is changed/added in the
> customer table. I would prefer not to have periodic updates/sync. The
> preferred method would reference the email field rather than update from
the
> email field.
> Example of use: When an end user modifies their personal info (email field
> in the customer table), the login will instantly be set/updated in the
> user_ID field in the security table.
> Any help is appreciated. Thanks.
Are the columns compatible datatypes? If so make the user_id column in the
security table a foreign key referencing the email column in the customer
table WITH UPDATE CASCADE. In order for this to work rhw email column must
have a UNIQUE or PRIMARY KEY CONSTRAINT.
http://snodland.blogspot.com
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.786 / Virus Database: 532 - Release Date: 30/10/2004|||"Kevin" <kevin_aoki@.NOSPAMhotmail.com123> wrote in message
news:9Oyhd.80$2N2.46980@.news.uswest.net...
> Hello everyone,
> We would like to have the user_ID field in the security table reference
> the
> email field in the Cusomer table. Basically, I would like instant updates
> of security login information when the email is changed/added in the
> customer table. I would prefer not to have periodic updates/sync. The
> preferred method would reference the email field rather than update from
> the
> email field.
> Example of use: When an end user modifies their personal info (email field
> in the customer table), the login will instantly be set/updated in the
> user_ID field in the security table.
> Any help is appreciated. Thanks.
Two words: UPDATE TRIGGER

No comments:

Post a Comment