shown_sunny
May 26th, 2004, 08:27 AM
dear friends,
Query1
======
***********************************************
SELECT @colvalue=column_name from information_schema.columns where ordinal_position=@cont and table_name=@tablename
***********************************************
Query2
======
***********************************************
select (select t.@colvalue from #trans_col t)
from information_schema.columns where ordinal_position=@cont and table_name=@tablename
****************************************************
1)These are the two queries within a procedure.
2)The solution I like to have is to get the value of a column_name.
3)The first query selects the corresponding name of a field .
4)What I wan't in the second query is to put this fieldname in the query and obtain the value of the corresponding field.
But this within the second query
***************************************
(select t.@colvalue from #trans_col t)
**************************************
doesn't work.
5)when i change the @ from colvalue ,the query returns only column name.
6)Is there a function in SQL SERVER to get the content of a fieldname
regards
shown_sunny
Query1
======
***********************************************
SELECT @colvalue=column_name from information_schema.columns where ordinal_position=@cont and table_name=@tablename
***********************************************
Query2
======
***********************************************
select (select t.@colvalue from #trans_col t)
from information_schema.columns where ordinal_position=@cont and table_name=@tablename
****************************************************
1)These are the two queries within a procedure.
2)The solution I like to have is to get the value of a column_name.
3)The first query selects the corresponding name of a field .
4)What I wan't in the second query is to put this fieldname in the query and obtain the value of the corresponding field.
But this within the second query
***************************************
(select t.@colvalue from #trans_col t)
**************************************
doesn't work.
5)when i change the @ from colvalue ,the query returns only column name.
6)Is there a function in SQL SERVER to get the content of a fieldname
regards
shown_sunny