January 12, 2015 at 10:56 am
create table dbo.dynamic(id int, name varchart)
insert into dbo.dynamic(id,name)
select 1,'pirana'
union
select 2,'shark'
union
select 3,'whale'
union
select 4, 'octopus'
January 12, 2015 at 11:11 am
Was there a question in there? I don't really get what you're asking for. (?)
Sigerson
"No pressure, no diamonds." - Thomas Carlyle
January 12, 2015 at 11:21 am
question is how to get the desired output.
January 12, 2015 at 11:33 am
Right, but you want an output column of 'value' that isn't in your input table, just 'rootid.' Are you looking for a way to generate that field 'value' as a string?
So that for octopus you get a 'value' field = 4, octopus, '*%**%***%***%' ? Is that what you want?
Sigerson
"No pressure, no diamonds." - Thomas Carlyle
January 12, 2015 at 11:35 am
yes for octopus
shark>octopus>whale
January 12, 2015 at 11:40 am
i was unclear on the requirements, myself....i thought this was a visualization of a hierarchy, so he'd want whale--shark--pirana--octopus
his sample table is a varchar(1), also, which would probably be an issue.
Lowell
January 12, 2015 at 11:42 am
sorry the post is confusing and will be corrected.
January 12, 2015 at 12:05 pm
I'm not sure how I would do this without using a CTE or a query.
One question I have is why you need to create the strings since the rootid values are giving you the ability to rank the result records. Or will there be many, many levels of ranking?
Also, will there be multiple names with the same value, such as:
*%octopus
*%tuna
*%lobster
**%shark
**%halibut
Sigerson
"No pressure, no diamonds." - Thomas Carlyle
January 13, 2015 at 12:12 am
scottichrosaviakosmos (1/12/2015)
question is how to get the desired output.
What is the desired output?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply