troubleshooting Question

SqL lookup table basics

Avatar of harveygs
harveygs asked on
DatabasesMicrosoft SQL ServerSQL
8 Comments1 Solution2422 ViewsLast Modified:
I have 400 computers that can have between 1 to 4 printers allocated. From a list of 20 printers. And also another column showing which one of those 4 is the default printer. This is queried in a VBS logon script.
I just need the table layout and SQL query not any vbs sript.
Being new to sql I dont know the best way to make the tables. I assume I would need 2 with a join.
first table 'Printer_List'
pr_id  name
1     epson99
2     hpthingy22
3     konicaxyz

2nd table PC_List
pc_name    pr1    pr2   pr3  pr4    default_printer                  where default would be = 1 to 4
room1       1          0     0     0        1
class77     3         2     0       0      2
pc99          4        0     0     0         4

a zero means no printer allocated
so for instance the pc called class77  has two printers allocated, konicaxyz and hpthingy22
and the hpthingy22 is to be the default printer.
eventually 6 variables
pr3=0 or null
pr4=0 or null
I hope that makes sense .


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros