May 9, 2013 at 5:30 am
Hi.
create table #variableta
(
assessment1 varchar(114),
assessment2 varchar(114),
assessment3 varchar(114),
assessment4 varchar(114),
asessment_pt1 varchar(114),
asessment_pt2 varchar(114),
asessment_pt3 varchar(114),
asessment_pt4 varchar(114),
code1 varchar(20),
code2 varchar(20),
code3 varchar(20),
code4 varchar(30)
)
insert into #variableta (txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4)
values ( 'test1','test2','test3','test4')
create table #testing1
(
code varchar(20),
descr varchar(114)
)
create table #testing2
(
code varchar(20),
descr varchar(114)
)
create table #testing2
(
code varchar(20),
descr varchar(114)
)
I need a output that, #variableta table-code1,code2,code3,code4 need to updated with #testing1 and #testing2 and #testing3 tables.
Need to find codes for assessment1,assessment2,assessment3,assessment4.
these fields values will be in descr field from #testing1 and #testing2 and #testing3 tables.
Please help me out how to reach this.
Regards,
tony
May 9, 2013 at 5:37 am
description1, description2, descritpion3, description4 fields values will any #testing tables.. and final output should in sigle row.
May 9, 2013 at 8:07 am
Can you please more clearly what you are trying to do here? From what you posted I can't come close to a guess at what you want here.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 9, 2013 at 9:22 pm
I am sorry for not given clear input.
In #variableta table, txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4 fields data will be availble in #testing1, #testing2,#testing3 tables.
We need to find code-id for txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4 fields.
suppose, txt_bh_assessment1 value will be there in #testing1(desc field), if it is there we should find code for the txt_bh_assessment1 field.
assessment value will be there in any of above 3 tables(#testing1,#testing2,#testing3).
I Need an output in the following way.
txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4, code1,code2,code3,code4
It should be in one row output.
I hope i given clear input. Please help me on this.
Regards,
Tony
May 10, 2013 at 7:11 am
tonyarp05 61903 (5/9/2013)
I am sorry for not given clear input.In #variableta table, txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4 fields data will be availble in #testing1, #testing2,#testing3 tables.
We need to find code-id for txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4 fields.
suppose, txt_bh_assessment1 value will be there in #testing1(desc field), if it is there we should find code for the txt_bh_assessment1 field.
assessment value will be there in any of above 3 tables(#testing1,#testing2,#testing3).
I Need an output in the following way.
txt_bh_assessment1,txt_bh_assessment2,txt_bh_assessment3,txt_bh_assessment4, code1,code2,code3,code4
It should be in one row output.
I hope i given clear input. Please help me on this.
Regards,
Tony
I have to say that doesn't really make it any clearer. Can you create some data for the #testing tables? Then a clear explanation of how those tables are related. From your explanation I don't understand why you need the other tables because all of the columns are in #variableta.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply