March 13, 2008 at 12:30 pm
Here's my issue. I've got a series of tables like so:
dbo.CustomerBobJones
dbo.CustomerJaneDoe
dbo.CustomerBrianSmith
Each contains these columns:
DateOfComment datetime
CommentText varchar(200)
Now all other customer information is stored in another table dbo.CustomerList
CustomerID int
CustomerName varchar(50)
Address varchar(50)
and so on.
I need to join from this customer list to the individual tables for those customers.
My thought was to add to dbo.CustomerList the name of the table associated to that account... but I'm not sure once that information is entered how I'll be able to join between them.
I had thought that the id in sysobjects might be the key but I'm not sure how to join using an id instead of a table name.
Can anyone throw me a bone on this?
March 13, 2008 at 12:49 pm
I'm thinking you should be setting each of those up as
bobJones.Customer
JaneDoe.Customer
BrianSmith.Customer
By using schemas (and associating those user logins with the correct schemas), you'd be able to write that as
Select * from Customer --would pull from the "non DBO" schema
Inner join dbo.CustomerList -- would pull from dbo, since it was specified.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply