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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting column value using Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-12-08 : 08:20:51
Mahesh writes "Hello Sir,

I have two tables which does not relate to each other.
one table contains 175 columns and in the same table there are some column which having column names like:
char_a1, char_a2,....
char_b1, char_b2,....

like these we have 125 columns, which contains integer values.

In other table we have some description related to these columns and one column which have values as column names described earlier (i.e. column name) and other column having its related values (i.e. this value should be there in first tables column i.e. char_a1, char_a2, char_a3, char_a4, char_a5, char_a6 i.e. these six columns of first table must contain a value which matches with the second tables column).

Now in Stored Procedure (SP) we are fetching the description from second table.

i am accessing the column name i.e. char_a1,char_a2,.... of first table using some loop and col_name function to which i am passing object_id of first tables column one by one thro loop.

but i also want to check the value inside that column with second tables column value and i am unable to get the value.

could u please explain me what to do with that.
if you send me your email id so that i can forward the SP so that you can understand it in proper way.

Mahesh Dhinge"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-09 : 01:21:41
Cant you use Inner Join?

Select T1.Value, T2.ColumnName from Table1 T1 inner join Table2 T2 on T1.Value=T2.Value

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -