Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Best way to create small mapping table

Author  Topic 

AdamWest
Constraint Violating Yak Guru

360 Posts

Posted - 2011-07-21 : 10:44:39
I have a Users table I had wanted to add a col to it but it seems it's better to make a new table.
The need has come up for this. We were showing a user-customer all the departments of the customer. So Joe who works at Acme can see all departments data in my dashboard.
Now they want to say Joe who works in Medical, will only see Medical department. I am not sure how to set this up. All these columns exist in other tables. I have a maintenance program that will be utilized to enter the new user-customer-department data.
I want to ensure the integrity of these 3 columnns or need i be worried at the program will handle that ? Do I need any keys for this new table or other columns?
The table would be:

UserID
Customerid
Departmentid






jcelko
Esteemed SQL Purist

547 Posts

Posted - 2011-07-21 : 11:49:03
Please post DDL with specs and not narratives or an invented language. We need keys, DRI actions, and constraints. Learn to use ISO-11179 rules for the data element names, avoid needless dialect and use ISO-8601 temporal formats, codes and so forth. Let us know if you can changed the DDL

>> I have a Users table I had wanted to add a col to it but it seems it's better to make a new table. <<

That's nice ..

>> The need has come up for this. We were showing a user-customer all the departments of the customer. So Joe who works at Acme can see all departments data in my dashboard. <<

Can you be more vague? What is a dashboard? Certainly not anything in the database and we database people NEVER discuss the front end.

>> Now they want to say Joe who works in Medical, will only see Medical department. I am not sure how to set this up. All these columns exist in other tables. I have a maintenance program that will be utilized to enter the new user-customer-department data. <<

Have you ever looked at the DCL? Just do not GRANT users PRIVILEGES on certain tables.

I have written a portal system years ago with a hierarchical access control model. But that can get elaborate. Example: “Everyone is the company has email – except Fred (we are still mad about that porno-spam thing he did)” or “Everyone in Engineering gets CAD access, then each engineering team gets only its project under CAD. And we set their home page to DILBERT”

This was a whole package, not a newsgroup problem.

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-07-21 : 13:58:00
>> Can you be more vague?

Can you be more unpleasant?

>> we database people NEVER discuss the front end.

horsecrap

>>I have written a portal system years ago with a hierarchical access control model. But that can get elaborate.

That's nice.
Go to Top of Page

Ghanta
Yak Posting Veteran

96 Posts

Posted - 2011-07-21 : 16:38:35
quote:
Originally posted by AdamWest

I have a Users table I had wanted to add a col to it but it seems it's better to make a new table.
The need has come up for this. We were showing a user-customer all the departments of the customer. So Joe who works at Acme can see all departments data in my dashboard.
Now they want to say Joe who works in Medical, will only see Medical department. I am not sure how to set this up. All these columns exist in other tables. I have a maintenance program that will be utilized to enter the new user-customer-department data.
I want to ensure the integrity of these 3 columnns or need i be worried at the program will handle that ? Do I need any keys for this new table or other columns?
The table would be:

UserID
Customerid
Departmentid





You can use different Schema
Go to Top of Page
   

- Advertisement -