|
hspc wrote: what if a device is connected to more than 2 nodes
We have decided that a device will connect to one or two nodes but not more than two.
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
jason_lakewhitney wrote: We have decided that a device will connect to one or two nodes but not more than two
Does that reflect reality?
I worked on a project a couple of years ago where there was an assumption that we only needed three connections between certain things. Then the client came along and asked 10 connections which broke our design and we (or rather I) spent 3 months re-writing the code due to a bad assumption being made.
|
|
|
|
|
Okay - I'm not familiar with nodes and devices in an electrical system. However option one looks like it describes a true many-to-many relationship. i.e. one node connects to many devices, one device connects to many nodes, therefore many devices connect to many nodes.
I just want to clarify what you are describing
(1) Node Table:
PK: NodeId
(3) Device Table:
PK: DeviceId
(2) Intermediate Table:
PK: NodeId, DeviceId
jason_lakewhitney wrote: This does not show how different devices might relate to each other nor does it give connectivity. To set up a query to get the rating of a bus can be done with some work.
How devices relate to each other is a different relationship. You can set up that relationship too.
If it is heirarchical then the Device table will contain a ParentDeviceId column as a foreign key that links to another row. If you only ever need to get the immediate parent or child this is quite efficient. If you need to get all children then you need to set up a separate table to denormalise the relationship. This adds duplicate information in a more efficient format for the queries you will run.
If Devices relate in a many-to-many way, then you can set up another intermediate table that links the two devices together.
Does this help?
|
|
|
|
|
Yes and no, it can be a little diffcult to explain. I work in the planning department along side the P.E.s they have describe the theoretical, physical and bussiness models of this system. This is the part way the helpdesk tech. is not getting it.
I should mention that a node is just a 'point in space' not physical but more of a location.
Theoretical Model - many devices are connected to many node.
Physical Model - many devices are connected to the physical bus where nodes are located.
Bussiness Model - many device are connected to one physical bus 'section' where nodes are the end points of the 'section'.
I have ranted many times about my situation. I, a developer, was hired to do a job but a helpdesk tech. has somehow worked his way to be in charge of the database design. His problem, I believe, is he is concetrated only on the theoretical model and he can't (or won't) look further into the data models.
Well, thanks for everyones input.
God Bless,
Jason
Programmer: A biological machine designed to convert caffeine into code. Developer: A person who develops working systems by writing and using software.
[ ^]
|
|
|
|
|
I agree with Colin, a real world DB setup would be the Many to Many relationship with an Associative Table between the two. Even if you never plan on having to utilize the many connections to many nodes, at least it would be setup if anything ever arose like that.
Cleako
|
|
|
|
|
The query I'm working on a query that selects all introduced leads. I have, of course, managed this part without a problem but the query needs to select only those that were introduced within the past month.
I have found the GETDATE keyword but how can i use this to find introduced leads. The leads have a date time stamp when they were created.
?
|
|
|
|
|
Use also DATEADD to work out when a month ago was.
e.g.
SELECT * FROM IntroductionLeads
WHERE CreatedDate >= DATEADD(month, -1, GETDATE())
|
|
|
|
|
Ok thanks for that. Works great. I take it there is no DATESUBTRACT then?
|
|
|
|
|
Sam Heller wrote: I take it there is no DATESUBTRACT then?
No, just supply a negative number to DATEADD .
|
|
|
|
|
SET @Stringer = '<br />
SELECT [ProductID],<br />
(SELECT Tagline FROM Products WHERE ProductID = P.ProductID) As Tagline,<br />
(SELECT U.[CompanyName] FROM Products K, Users U WHERE K.ProductID = P.ProductID AND K.UserID = U.UserID) As [Company Name],<br />
(SELECT Logo FROM Products WHERE ProductID = P.ProductID) As Logo,<br />
[Actual Speed],<br />
[Actual APR],<br />
[Actual Broker Fee],<br />
[Completion Ratio],<br />
CONVERT(decimal(18, 1),(([Speed] + [APR] + [BrokerFee] + [Completion Ratio] + [Commission] + [List Bid]) / 6)) AS HSScore <br />
FROM #temp P'
The following code does not seem to work. The error is produced from the line
(SELECT U.[CompanyName] FROM Products K, Users U WHERE K.ProductID = P.ProductID AND K.UserID = U.UserID) As [Company Name]
Is it not possible to put table aliases inside a string and then execute it?
|
|
|
|
|
I would have done them as joins rather than inner queries.
Sam Heller wrote: Is it not possible to put table aliases inside a string and then execute it?
Yes, you can use table aliases inside dynamic SQL.
|
|
|
|
|
Table aliases are fine within dynamic SQL.
What is the error message? Try adding PRINT @Stringer after this code and before the EXEC or sp_executesql that you are using to run it.
|
|
|
|
|
Stupid Stupid Stupid. Turns out I had set the varchar for the string to 500 and it query had just about reached that so the string was missing the FROM section of the query.
Thanks anyway though
|
|
|
|
|
You're not alone
|
|
|
|
|
Hi ,
Please someone show me a code that updates records of a table one by one using a cursor . I counld'nt find one !.
|
|
|
|
|
|
Is there anybody who has a merge module or any other way of deploying SQL Server 2005? The InstallShield site says they still don't have it, and that the users should make their own custom setup procedures, and Microsoft still does not show the way of easily deploy SQL server 20005 Express with any installation. But they did ban the MSDE from Vista, so any installation that includes MSDE and is targeting Vista needs to be changed.
Thanks.
Sarajevo, Bosnia
|
|
|
|
|
Hello
I have an application writing Japanese characters to the database. When I use MS SQL 2000, it works fine - the complete string is stored, but when I use MSDE, the strings seems to be truncated
Any ideas? Is there any setting in MSDE that I'm overlooking?
Thanks for any help
Chandra
|
|
|
|
|
Hi Guru's,
What's the trim command on SQL?
Thanks
Dom;)
|
|
|
|
|
Hi,
Using trim in SQL 2000 - ltrim() and rtrim() as given below: removes trailing and leading blanks. Hope this helps you.
For Example:
------------
use pubs
go
select ltrim(rtrim(fname)) from
employee
go
- Harini
|
|
|
|
|
Thanks Harini
|
|
|
|
|
I have a table that stores two types of update records. At the moment I'm using a bit field to determine the update type, e.g. IsStatusUpdate. This value is 0 for comment updates and 1 for status updates. It has been bothering me recently that this could be made a char(1) field, with the more readable 'S' for status updates and 'C' for comment updates.
My only misgiving here though is the use of a literal value that is seemingly arbitrary to the user. With 'IsStatuUpdate bit, not null', I know I must store 1 for a status update. With 'UpdateType char(1), not null', I don't know that I must store 'S' for a status update. Any thoughts on this?
|
|
|
|
|
Bit fields will required less storage.
Also better when using with code (C# for example) because you'll need to deal with true,false. not magic values (S,C).
In the GUI, you can use a check box.
I think it's always better to separate how you display data from how you store it.
|
|
|
|
|
If I have a DataRow and a foreign key constraint (1:N), is there a way to get a DataTable with all of the childs of the relationship?
e.g. if I have
DepartmentDataTable dep = ...
EmployeeDataTable emp = ...
ForeignKeyConstraint fk = new ForeignKeyConstraint(dep.IDColumn, emp.DepartmentIDColum);
DepartmentRow hq = dep.FindByID(666);
EmployeeDataTable allHQEmployees = magic</>(hq, fk);
?
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
Have you tried using the DataRow.GetChildRows() method? If you define a DataRelation instead of a ForeignKeyConstraint (which will be added along with the DataRelation) you can use DataRow.GetChildRows() to get a DataRow[] reference. Once you have DataRow[] you could instantiate a new EmployeeDataTable and copy DataRow[] into the new data table using the DataTable.ImportRow() method.
You could alternatively do something using a DataView, sort by DepartmentID and call DataView.FindRows(), then perform the same copy operation I mentioned above.
But other than creating a new table object and copying rows from one table to the next there is no way to return a new data table based on a "filter" of an existing table.
|
|
|
|