| Author |
Topic |
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 07:09:34
|
I have a table structure similar to listed belowFrmTemplatefrmTemplatePK frmTemplateName100 AAAAA101 BBBBBB FrmTemplateFieldsFrmTemplateFieldPK frmTemplateFK DefaultLabel ValueConainerOrder200 100 Label1 0 201 100 Label2 1202 101 XLabel1 0203 101 XLabel2 1204 101 XLabel3 2This table contains the field definition and it references FrmTemplateFK FrmValueContainerFrmContainerPK frmTemplateFK Value1 Value2 Value3 Value4 300 100 Val1 Val2 301 101 XVal1 XVal2 XVal3 This Table holds the values of the defined fields. This again references FrmTemplateFK I want to create a view/inline function which accepts frmTemplateFK and gives a result as listed below If I pass 100FrmTemplateName Label1 Label2AAAAA Val1 Val2If 101 is PassedFrmTemplateName XLabel1 XLabel2 XLabel3BBBBB XVal1 XVal2 XVal3 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 08:54:27
|
| Thanks for your reply.I guess your solution is to fetch top n columns. But in my case I need to convert rows in FrmTemplateFields into columnswith the corresponding values and resultant resultset shouldbe captured in a view. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 08:57:40
|
| From your expected result I think that will give you the solutionPost your exact expected resultMadhivananFailing to plan is Planning to fail |
 |
|
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 09:17:38
|
Sorry If I am confusing in my question.I have given the expected result in my question.I can give it once again.I need to create a inline function which may take FrmTemplatePk as parameter and return me something like this.FrmTemplateName Label1 Label2AAAAA Val1 Val2 Here "Label1 and Labels" are the records/rows in "FrmTemplateFields" and the "Val1" and "Val2"are records/rows in "FrmValueContainer"Thanks for your help.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 09:30:53
|
| Why do you want to do this?Where do you use this result?MadhivananFailing to plan is Planning to fail |
 |
|
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 09:39:38
|
| I need this for reporting. I was planning for a view. I am not so sure about getting this result in a single query. So I was planning either for a In-line UDF / Multi-statement UDF.In-line can take only a statement and for Multi-statement UDF we have to define a table for result.The constraint in the table is we have to define the columns for the result.In my case the number of columns for the result vary. So I am bit confused about which approach to go on.I am very much new-bie for advance db programming though I am familiar with SQL. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 09:42:17
|
| Which Reporting Tool are you using?I think you can hide the columns at runtime by checking the valuesIf values are Nulls then suppres themMadhivananFailing to plan is Planning to fail |
 |
|
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 09:46:20
|
| The problem here is I need to just prepare this Data pump(View).This will be used by couple of applications which expects results in that format. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-19 : 09:50:20
|
| Instead of doing this in View why cant you use Suppress option of Reports?I think that will be easiest way than doing this in SQL Server ViewWhat is your Reporting Tool?MadhivananFailing to plan is Planning to fail |
 |
|
|
Vj
Starting Member
8 Posts |
Posted - 2005-10-19 : 10:11:36
|
| I dont have a control over the reporting. A view is expected in that format. This is view willbe used by other application which expects this format. Is there a complex/simple way to approach this. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|