Auto-Attribute Creation

B

Brian

I have a "Person" table with 'First Name' and 'Last
Name'. I have a 2nd table, "Employee" with 'Employee ID'.
How can I create a condition to make 'Employee ID' equal
to the first initial of 'First Name' and 'Last Name' plus
a unique 1-digit number, if necessary?

I tried editing the value/range for column 'Employee ID',
but the boxes are grayed out. It is set as 'Required'
and 'Primary Key'.

Thanks for any help you can provide.
 
A

Anthony Bloesch [MSFT]

The solution to this will depend on the DBMS you are targeting. But in
general, for DBMS efficiency reasons, row constraints cannot use
expressions that cross table boundaries. Assuming you are on the chech
clause tab of the column properties. The reason the edit box is greyed out
may be because your DBMS does not support creating these constraints.

It is generally considered poor practice to store calculated values like
this in a database since data can get out of sync. As an alternative
consider creating a view that has a column that performs the calculation.

Anthony

--------------------
Content-Class: urn:content-classes:message
From: "Brian" <pcintegrity_at@no_spam_comcast.net>
Sender: "Brian" <pcintegrity_at@no_spam_comcast.net>
Subject: Auto-Attribute Creation
Date: Mon, 11 Aug 2003 21:16:56 -0700
Lines: 11
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcNgiJD6WwVKxQW2Th62CDtbCMbHuA==
Newsgroups: microsoft.public.visio.database.modeling
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.visio.database.modeling:3020
NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
X-Tomcat-NG: microsoft.public.visio.database.modeling

I have a "Person" table with 'First Name' and 'Last
Name'. I have a 2nd table, "Employee" with 'Employee ID'.
How can I create a condition to make 'Employee ID' equal
to the first initial of 'First Name' and 'Last Name' plus
a unique 1-digit number, if necessary?

I tried editing the value/range for column 'Employee ID',
but the boxes are grayed out. It is set as 'Required'
and 'Primary Key'.

Thanks for any help you can provide.



--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top