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 |
|
em00guy
Starting Member
6 Posts |
Posted - 2006-08-23 : 14:31:25
|
| I have a stored procedure that outputs a string based on an integer input. Each string corrresponds to records returned by another procedure. As such, The following is what im trying to do,SELECT users.fname, users.lname, (EXEC dbo.listOfMothers users.motherID)[maternal_heiarchy]FROM dbo.usersWhere uid = @uidlistOfMothers outputs a string of the persons mother and their mother and so on. This is what the data should look like.fname__________lname__________maternal_heiarchy-----------------------------------------------jason__________foobar_________edna, margret, olgasarah__________ishot__________hotterMom, hotForAGramaOf course, this does not work. I hope this illustrates the principle of my efforts. I would be greatly appreciative of anyone who can help me figure out what i'm trying to do. Thanks. |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2006-08-23 : 14:36:29
|
you'll need a 'function' (UDF - User defined Function) instead of a procedure to do what you are attempting...Select users.fname, users.lname, [maternal_heirarchy] = dbo.listOfMothers(users.motherId)from dbo.usersWhere uid = @uidCorey Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..." |
 |
|
|
em00guy
Starting Member
6 Posts |
Posted - 2006-08-23 : 15:41:58
|
quote: Originally posted by Seventhnight you'll need a 'function' (UDF - User defined Function) instead of a procedure to do what you are attempting...Select users.fname, users.lname, [maternal_heirarchy] = dbo.listOfMothers(users.motherId)from dbo.usersWhere uid = @uidworked brilliantly. Thanks!!Corey Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..." 
|
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|