Showing posts with label address. Show all posts
Showing posts with label address. Show all posts

Friday, March 23, 2012

Multiple FK or "TableName" column?

Hi!
I have a table "addresses". Address can be associate to a customer, an
employee, a supplier or a consultant. Every of these 5 have a table with an
identity primary key. My question is simple: Which of the 2 ways is the best
to link the "Addresses" table to other tables?
A- By adding 5 foreign keys, assuming that only one will be NOT NULL by reco
rd
B- Adding a column Varchar "ParentTable" and a Int column "ParentID" to make
the relation programmatically?
I need the best way to be faster and also easier to implement...
Thanks in Advance!David Parenteau wrote:
> Hi!
> I have a table "addresses". Address can be associate to a customer, an
> employee, a supplier or a consultant. Every of these 5 have a table
> with an identity primary key. My question is simple: Which of the 2
> ways is the best to link the "Addresses" table to other tables?
> A- By adding 5 foreign keys, assuming that only one will be NOT NULL
> by record B- Adding a column Varchar "ParentTable" and a Int column
> "ParentID" to make the relation programmatically?
> I need the best way to be faster and also easier to implement...
> Thanks in Advance!
Or C - Create 5 tables for CustomerAddress, EmployeeAddress, etc.
Or D - Add an AddressID to the Customer, Employee, etc. tables if they
can only have one address (probably not the case)
Or E - Create a generic Person table and a PersonAddress table. Relate
Person to Customer, Employee, etc.
I don't like option A and option B is not relational.
David Gugick
Quest Software
www.imceda.com
www.quest.com|||First of all, an IDENTITY cannot ever be a key by definition, so the
schema is screwed up from the start. Ignoring that fundamental
problem, start by asking the basic questions:
1) Is an address an attribute of a customer, an employee, a supplier
and a consultant? In which case you need a SAN (Standard Address
Number) or equivalent in a column in those tables. I am assuming that
people fall into one and only one of these roles and that they are
logically different. Otherwise, there would be a People table.
2) Is there a one-to-many relationship between an address and a
customer, an employee, a supplier or a consultant? That case, you will
need tables to model the customer-addresses, the employee-addresses,
the supplier-addresses and the consultant-addresses relationships. I
would also add type codes to the addresses (ship-to, bill-to, etc.).|||Wow... suggestion!
Yes, more than one adress per customers, etc...
For E, does the Person table has 5 FK, one for each table or you mean 5
Person table, one for customer, one for employee, and so on?
Addresses should be the same columns for each 5 entities, so Solution C
seems to be not the quickest way to choose if a change must occur in the
schema... WHat do you think about this?
"David Gugick" wrote:

> David Parenteau wrote:
> Or C - Create 5 tables for CustomerAddress, EmployeeAddress, etc.
> Or D - Add an AddressID to the Customer, Employee, etc. tables if they
> can only have one address (probably not the case)
> Or E - Create a generic Person table and a PersonAddress table. Relate
> Person to Customer, Employee, etc.
> I don't like option A and option B is not relational.
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>|||First create and load this table. might want to look at Melissa Data
software to edit the addresses,
CREATE TABLE Addresses
(address_nbr INTEGER NOT NULL PRIMARY KEY,
street1 CHAR(35) NOT NULL,
street2 CHAR(35),
street3 CHAR(35),
city_name CHAR(20) NOT NULL,
state_code CHAR(2) NOT NULL,
zip4 CHAR(10) NOT NULL
CHECK (zip4 LIKE '[0-9][0-9][0-9][0-9][0-9]'
OR zip4 LIKE
'[0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'),
verification_date DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL);
Next, create each of the tables with the proper key for that kind of
entity. For suppliers, the Dun & Bradsteet codes are common; employees
better have an SSN, etc.
CREATE TABLE Suppliers
(duns_nbr CHAR(9) NOT NULL PRIMARY KEY,
supplier_name CHAR(35) NOT NULL,
.);
Now create a relationship table between each of the entities and the
addresses:
CREATE TABLE SupplierAddresses
(duns_nbr CHAR(9) NOT NULL
REFERENCES Suppliers(duns_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
address_nbr INTEGER NOT NULL,
REFERENCES Addresses(address_nbr)
ON UPDATE CASCADE
ON DELETE CASCADE,
supplier_address_type CHAR(5) INTEGER NOT NULL
CHECK (supplier_address_type IN ('ship', 'bill', 'HQ', 'serv',
...)),
PRIMARY KEY (duns_nbr, address_nbr));
Make heavy use of DRI actions to maintian data integrity. Take time to
invent good address type codes for each logical entity (i.e. a customer
does not have a service department or a headquarters).|||About the Identity that cannot be a Key, do you mean a "Natural key"? If yes
,
I'm agree.
I used to set a FieldID INT Identity has a Primary key in my tables, to
avoid multiple-field primary keys. This seems to be easier to locate a recor
d
from a web application or application... Does this a very bad thing to do? I
f
yes, why?
David
"--CELKO--" wrote:

> First of all, an IDENTITY cannot ever be a key by definition, so the
> schema is screwed up from the start. Ignoring that fundamental
> problem, start by asking the basic questions:
> 1) Is an address an attribute of a customer, an employee, a supplier
> and a consultant? In which case you need a SAN (Standard Address
> Number) or equivalent in a column in those tables. I am assuming that
> people fall into one and only one of these roles and that they are
> logically different. Otherwise, there would be a People table.
> 2) Is there a one-to-many relationship between an address and a
> customer, an employee, a supplier or a consultant? That case, you will
> need tables to model the customer-addresses, the employee-addresses,
> the supplier-addresses and the consultant-addresses relationships. I
> would also add type codes to the addresses (ship-to, bill-to, etc.).
>|||Celko,
I now have a new example: A table activity. But the "activities" will need
to be linked to all 150 tables in my database... So, is it a reason to avoid
creating 150 link tables and keep the table name in a column of the
"Activity" table?
Thanks!!
"--CELKO--" wrote:

> First of all, an IDENTITY cannot ever be a key by definition, so the
> schema is screwed up from the start. Ignoring that fundamental
> problem, start by asking the basic questions:
> 1) Is an address an attribute of a customer, an employee, a supplier
> and a consultant? In which case you need a SAN (Standard Address
> Number) or equivalent in a column in those tables. I am assuming that
> people fall into one and only one of these roles and that they are
> logically different. Otherwise, there would be a People table.
> 2) Is there a one-to-many relationship between an address and a
> customer, an employee, a supplier or a consultant? That case, you will
> need tables to model the customer-addresses, the employee-addresses,
> the supplier-addresses and the consultant-addresses relationships. I
> would also add type codes to the addresses (ship-to, bill-to, etc.).
>

Wednesday, March 21, 2012

Multiple EMails per Subscriber

Is it possible to have a subscriber specify more than one e-mail address for a subscription? ie, they want a notification sent to two different email accounts.

Thanks,

Dan

Yes, it is possible, but a much easier solution to this problem would be to treat these 2 email addresses as if they belonged to 2 different subscribers.

In other words, it's much easier: 1 email address == 1 subscriber. Although those 2 distinct subscribers can be 1 and the same "physical" person.

It's all managed by SMI classes.

|||Sure. Each subscriber can have multiple subscriberdevices associated with them. Just mind the match rule.

Joesql

Wednesday, March 7, 2012

Multiple Columns

Hi,
I am attempting to design an address list which will print in multiple
columns, like so:
Company One
Address Line 1
Address Line 2
Address Line 3
Company Two
etc....
This should continue down the page and fill up two columns. However, the
second column is always empty. Am I missing something? I am using a list
control to repeat the fields, and have set the Columns property to 2. Is
there anything more I need to do to get the second column to appear?
TIA,
Peter"Steffen" <Steffen@.discussions.microsoft.com> wrote in message
news:DDD47287-4639-4D1B-AB1A-3CF361C74A03@.microsoft.com...
>I had the same problem.
> it can have 2 causes:
> 1. the sum of the width of your columns and the spacing between is more
> than
> the width of the page
> 2. you need to have a Page Header (even if you set it to zero)
> "Peter Kenyon" wrote:
>
Thanks, that solved it. The Preview window still only shows one column, but
Print Preview and PDF format show two columns.
Peter

Monday, February 20, 2012

Multipe receipients for Operators in SQL 2005?

Using database mail. It works using a single email address for an operator.
Adding a second email address after a semicolon still sends to the first
email address but not the second. Separating them with a comma breaks the
whole thing, no email is sent.
Does this mean I have to create a dl in Exchange, if I need to notify more
than one person for a given event?
GerhardHi Gerhard,
That's usually the easiest way. It also allows who is on the list to be
managed externally easily.
HTH,
Greg
"Gerhard" <gerhardpremovethis@.inch.com> wrote in message
news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
> Using database mail. It works using a single email address for an
> operator.
> Adding a second email address after a semicolon still sends to the first
> email address but not the second. Separating them with a comma breaks the
> whole thing, no email is sent.
> Does this mean I have to create a dl in Exchange, if I need to notify more
> than one person for a given event?
> Gerhard
>|||Thanks Greg,
So are you saying it cannot be managed from the Operator page?
I would have preferred to handle it in SQL Server rather than Exchange,
Gerhard
"Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...
> Hi Gerhard,
> That's usually the easiest way. It also allows who is on the list to be
> managed externally easily.
> HTH,
> Greg
> "Gerhard" <gerhardpremovethis@.inch.com> wrote in message
> news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
the[vbcol=seagreen]
more[vbcol=seagreen]
>|||Greg,
Forget that question. It works with semicolons. I re-created everything
today and did some more testing. SQL 2005 has been difficult for us.
One thing I've noticed is that things often don't work on the first try, and
then when you blow them away and re-create them they start working.
I have a SRX with Microsoft right now, not on this, on something much more
serious where even they can't get it to work. It is just not working at
all. I guess I keep forgetting that it is an initial release and that it
behaves as such,
Gerhard
"Gerhard Paulman" <gerhardpremovethis@.inch.com> wrote in message
news:uKWQvLaJGHA.3224@.TK2MSFTNGP09.phx.gbl...
> Thanks Greg,
> So are you saying it cannot be managed from the Operator page?
> I would have preferred to handle it in SQL Server rather than Exchange,
> Gerhard
> "Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
> news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...
first[vbcol=seagreen]
> the
> more
>

Multipe receipients for Operators in SQL 2005?

Using database mail. It works using a single email address for an operator.
Adding a second email address after a semicolon still sends to the first
email address but not the second. Separating them with a comma breaks the
whole thing, no email is sent.
Does this mean I have to create a dl in Exchange, if I need to notify more
than one person for a given event?
Gerhard
Hi Gerhard,
That's usually the easiest way. It also allows who is on the list to be
managed externally easily.
HTH,
Greg
"Gerhard" <gerhardpremovethis@.inch.com> wrote in message
news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
> Using database mail. It works using a single email address for an
> operator.
> Adding a second email address after a semicolon still sends to the first
> email address but not the second. Separating them with a comma breaks the
> whole thing, no email is sent.
> Does this mean I have to create a dl in Exchange, if I need to notify more
> than one person for a given event?
> Gerhard
>
|||Thanks Greg,
So are you saying it cannot be managed from the Operator page?
I would have preferred to handle it in SQL Server rather than Exchange,
Gerhard
"Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...[vbcol=seagreen]
> Hi Gerhard,
> That's usually the easiest way. It also allows who is on the list to be
> managed externally easily.
> HTH,
> Greg
> "Gerhard" <gerhardpremovethis@.inch.com> wrote in message
> news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
the[vbcol=seagreen]
more
>
|||Greg,
Forget that question. It works with semicolons. I re-created everything
today and did some more testing. SQL 2005 has been difficult for us.
One thing I've noticed is that things often don't work on the first try, and
then when you blow them away and re-create them they start working.
I have a SRX with Microsoft right now, not on this, on something much more
serious where even they can't get it to work. It is just not working at
all. I guess I keep forgetting that it is an initial release and that it
behaves as such,
Gerhard
"Gerhard Paulman" <gerhardpremovethis@.inch.com> wrote in message
news:uKWQvLaJGHA.3224@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Thanks Greg,
> So are you saying it cannot be managed from the Operator page?
> I would have preferred to handle it in SQL Server rather than Exchange,
> Gerhard
> "Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
> news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...
first
> the
> more
>

Multipe receipients for Operators in SQL 2005?

Using database mail. It works using a single email address for an operator.
Adding a second email address after a semicolon still sends to the first
email address but not the second. Separating them with a comma breaks the
whole thing, no email is sent.
Does this mean I have to create a dl in Exchange, if I need to notify more
than one person for a given event?
GerhardHi Gerhard,
That's usually the easiest way. It also allows who is on the list to be
managed externally easily.
HTH,
Greg
"Gerhard" <gerhardpremovethis@.inch.com> wrote in message
news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
> Using database mail. It works using a single email address for an
> operator.
> Adding a second email address after a semicolon still sends to the first
> email address but not the second. Separating them with a comma breaks the
> whole thing, no email is sent.
> Does this mean I have to create a dl in Exchange, if I need to notify more
> than one person for a given event?
> Gerhard
>|||Thanks Greg,
So are you saying it cannot be managed from the Operator page?
I would have preferred to handle it in SQL Server rather than Exchange,
Gerhard
"Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...
> Hi Gerhard,
> That's usually the easiest way. It also allows who is on the list to be
> managed externally easily.
> HTH,
> Greg
> "Gerhard" <gerhardpremovethis@.inch.com> wrote in message
> news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
> > Using database mail. It works using a single email address for an
> > operator.
> > Adding a second email address after a semicolon still sends to the first
> > email address but not the second. Separating them with a comma breaks
the
> > whole thing, no email is sent.
> > Does this mean I have to create a dl in Exchange, if I need to notify
more
> > than one person for a given event?
> > Gerhard
> >
> >
>|||Greg,
Forget that question. It works with semicolons. I re-created everything
today and did some more testing. SQL 2005 has been difficult for us.
One thing I've noticed is that things often don't work on the first try, and
then when you blow them away and re-create them they start working.
I have a SRX with Microsoft right now, not on this, on something much more
serious where even they can't get it to work. It is just not working at
all. I guess I keep forgetting that it is an initial release and that it
behaves as such,
Gerhard
"Gerhard Paulman" <gerhardpremovethis@.inch.com> wrote in message
news:uKWQvLaJGHA.3224@.TK2MSFTNGP09.phx.gbl...
> Thanks Greg,
> So are you saying it cannot be managed from the Operator page?
> I would have preferred to handle it in SQL Server rather than Exchange,
> Gerhard
> "Greg Low [MVP]" <greglow@.lowell.com.au> wrote in message
> news:e6n1IJWJGHA.2696@.TK2MSFTNGP14.phx.gbl...
> > Hi Gerhard,
> >
> > That's usually the easiest way. It also allows who is on the list to be
> > managed externally easily.
> >
> > HTH,
> >
> > Greg
> >
> > "Gerhard" <gerhardpremovethis@.inch.com> wrote in message
> > news:O$Zd07TJGHA.3912@.TK2MSFTNGP10.phx.gbl...
> > > Using database mail. It works using a single email address for an
> > > operator.
> > > Adding a second email address after a semicolon still sends to the
first
> > > email address but not the second. Separating them with a comma breaks
> the
> > > whole thing, no email is sent.
> > > Does this mean I have to create a dl in Exchange, if I need to notify
> more
> > > than one person for a given event?
> > > Gerhard
> > >
> > >
> >
> >
>