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.
| Author |
Topic |
|
TimothyJ
Starting Member
2 Posts |
Posted - 2007-08-14 : 09:30:53
|
Hello there,I'm designing a database of office equipment at my workplace. Basically I have a table of 'Machines' that have an ID, a username associated with it, a CPU-ID and a couple of other bits of information.Previously I had a column for a Monitor-ID, where the ID corelated to an entry in a Monitor table. It seemed like the right thing to do, until some people started getting two monitors.What I've done now instead is have a MonitorsInstalled table. There's a primary key which isn't really used for anything but being unique. Then there's a MachineID and a MonitorID column. The next thing is there can be two entries with the same Machine ID, fixing the whole multiple monitor issue.However, I have a View setup. Previously the View just listed the monitor name. Now what I'd like to do is concatonate all the monitors associated with one machine and place it into its own column.So say Machine 321 has a HP1702 and a HPL1940T, and machine 654 has only a HP1702, the view would look likeMachineID Monitor321 HP1702 & HPL1940T654 HP1702Is it possible to do this in a function or stored procedure? If it is, could anyone give me some tips? I'd really appreciated it.Thanks! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
TimothyJ
Starting Member
2 Posts |
Posted - 2007-08-14 : 11:27:00
|
| That worked wonders, thank you :) |
 |
|
|
|
|
|
|
|