Click here to Skip to main content
15,920,053 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL tutorial Pin
Sathesh Sakthivel18-Jul-07 17:26
Sathesh Sakthivel18-Jul-07 17:26 
GeneralRe: SQL tutorial Pin
Rob Graham19-Jul-07 3:42
Rob Graham19-Jul-07 3:42 
AnswerRe: SQL tutorial Pin
Sathesh Sakthivel18-Jul-07 17:10
Sathesh Sakthivel18-Jul-07 17:10 
GeneralRe: SQL tutorial Pin
firestoper18-Jul-07 17:24
firestoper18-Jul-07 17:24 
GeneralRe: SQL tutorial Pin
Sathesh Sakthivel18-Jul-07 17:27
Sathesh Sakthivel18-Jul-07 17:27 
AnswerRe: SQL tutorial Pin
Krish - KP18-Jul-07 17:25
Krish - KP18-Jul-07 17:25 
QuestionCan somebody write a stored proc for this problem please? Pin
rajugrover18-Jul-07 8:29
rajugrover18-Jul-07 8:29 
AnswerRe: Can somebody write a stored proc for this problem please? Pin
Colin Angus Mackay18-Jul-07 8:54
Colin Angus Mackay18-Jul-07 8:54 
rajugrover wrote:
the table says that s1 is the boss of s2. if s1 does not have a boss then s2 is null


Then why not give the columns meaningful names. s1 = employee; s2 = manager


rajugrover wrote:
I mean starting from manager1 select recursively down to the last leaf.


I've done this before - it is a difficult and time consuming query. SQL isn't so good at recursion. What I did was create a trigger so that when data was inserted, updated or deleted a denormalised version of the table was updated. If I needed to know everyone from PersonX downwards I could just query the denormalised table.

The denormalised table contains just two columns the superior and the subordinate. I'm presuming the table you show has more columns. The denormalised version can then be joined with the normalised version to get any additional data.

Unfortunately, off the top of my head, I don't remember how it was implemented so I can't give you code right now. But hopefully the above should guide you in a reasonable direction.


Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...

"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."


My website

GeneralRe: Can somebody write a stored proc for this problem please? Pin
originSH18-Jul-07 22:17
originSH18-Jul-07 22:17 
AnswerRe: Can somebody write a stored proc for this problem please? Pin
Pete O'Hanlon18-Jul-07 9:17
mvePete O'Hanlon18-Jul-07 9:17 
GeneralRe: Can somebody write a stored proc for this problem please? Pin
Paul Conrad18-Jul-07 9:38
professionalPaul Conrad18-Jul-07 9:38 
GeneralRe: Can somebody write a stored proc for this problem please? Pin
Pete O'Hanlon18-Jul-07 9:46
mvePete O'Hanlon18-Jul-07 9:46 
GeneralRe: Can somebody write a stored proc for this problem please? Pin
Paul Conrad18-Jul-07 12:11
professionalPaul Conrad18-Jul-07 12:11 
AnswerRe: Can somebody write a stored proc for this problem please? Pin
DQNOK18-Jul-07 11:54
professionalDQNOK18-Jul-07 11:54 
QuestionGetting registered for SQL Notifications Pin
~~~Johnny~~~18-Jul-07 6:51
~~~Johnny~~~18-Jul-07 6:51 
QuestionDeleting Records using two different Databases Pin
bwhittington18-Jul-07 5:18
bwhittington18-Jul-07 5:18 
AnswerRe: Deleting Records using two different Databases Pin
Pete O'Hanlon18-Jul-07 5:26
mvePete O'Hanlon18-Jul-07 5:26 
GeneralRe: Deleting Records using two different Databases Pin
bwhittington18-Jul-07 5:34
bwhittington18-Jul-07 5:34 
AnswerRe: Deleting Records using two different Databases Pin
Chris Rickard18-Jul-07 18:21
Chris Rickard18-Jul-07 18:21 
Questiondata storage & access of data in sqlserver Pin
Sandep H S18-Jul-07 4:35
Sandep H S18-Jul-07 4:35 
AnswerRe: data storage & access of data in sqlserver Pin
originSH18-Jul-07 4:45
originSH18-Jul-07 4:45 
QuestionData Bindings Pin
Rharzkie18-Jul-07 1:32
Rharzkie18-Jul-07 1:32 
AnswerRe: Data Bindings Pin
Colin Angus Mackay18-Jul-07 2:10
Colin Angus Mackay18-Jul-07 2:10 
GeneralRe: Data Bindings Pin
Mike Dimmick18-Jul-07 2:30
Mike Dimmick18-Jul-07 2:30 
GeneralRe: Data Bindings Pin
originSH18-Jul-07 3:21
originSH18-Jul-07 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.